Publit.Si
Google OAuth error

invalid_grant

Google no longer accepts the saved sign-in: its refresh token expired, was revoked or was replaced. Sign in again with Reconnect; if it happens every 7 days, your Google project is still in Testing.

What the error means

Google returns invalid_grant when the token used to renew access has expired or has been invalidated. Its advice: sign the user in again and ask for consent to get new tokens.[1] Right after a sign-in, the same code means the authorization code was invalid. Starting the sign-in again fixes that.[2]

Common causes

  • Your Google project is External and in Testing. Its refresh tokens expire after 7 days.[3][4]
  • You removed the app's access in your Google account.[5]
  • The token wasn't used for six months.[6]
  • More than 100 refresh tokens exist for the same Google account and client. Google then drops the oldest without warning.[7]
  • A Google Workspace admin set a requested service to Restricted. That shows as admin_policy_enforced.[8]
  • The Google account was deleted or disabled.[1]

How to fix it

  1. Publit.Si → Accounts → open the YouTube account → Reconnect. Don't disconnect first: that cancels scheduled posts.[9]
  2. Sign in with the same Google account and tick Select all on Google's permission screen.[9]
  3. Check Google Auth Platform → Audience → Publishing status. Testing means a new sign-in every 7 days.[4]
  4. To end the weekly reconnect, publish the project to In production (it needs Branding on your own domain), then reconnect once.[9][10]
  5. For personal use with fewer than 100 users, Google doesn't require verification for this.[11]

How Publit.Si handles it

Publit.Si renews the short access token by itself as long as Google's sign-in behind it is valid. In Testing that sign-in still ends after 7 days, and Publit.Si reminds you to reconnect.[9] Publit.Si can't tell from the token whether your project is in Testing or In production. Google Auth Platform → Audience → Publishing status shows it.[9]

Questions

Why does YouTube stop working every week?

Your Google project is External and in Testing, and Google lets its refresh tokens expire after 7 days. Publish the project to In production once and reconnect.

Will reconnecting delete my scheduled posts?

No. Reconnect keeps them. Disconnecting the account cancels scheduled posts, so always use Reconnect.

Does production need Google's review?

Not for your own use with fewer than 100 users. The unverified-app warning stays, but you can click through it.

Sources

  1. [1] Google: OAuth 2.0 for Web Server Applications: https://developers.google.com/identity/protocols/oauth2/web-server, checked November 17, 2026
    „When refreshing an access token or using incremental authorization, the token may have expired or has been invalidated. Authenticate the user again and ask for user consent to obtain new tokens. If you are continuing to see this error, ensure that your application has been configured correctly and that you are using the correct tokens and parameters in your request. Otherwise, the user account may have been deleted or disabled.“
  2. [2] Google: OAuth 2.0 for Web Server Applications: https://developers.google.com/identity/protocols/oauth2/web-server, checked November 17, 2026
    „The supplied authorization code is invalid or in the wrong format. Request a new code by restarting the OAuth process to prompt the user for consent again.“
  3. [3] Google: Using OAuth 2.0 to Access Google APIs: https://developers.google.com/identity/protocols/oauth2, checked November 17, 2026
    „A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days, unless the only OAuth scopes requested are a subset of name, email address, and user profile (through the userinfo.email, userinfo.profile, openid scopes, or their OpenID Connect equivalents).“
  4. [4] Google Cloud Help: Manage App Audience: https://support.google.com/cloud/answer/15549945?hl=en, checked November 17, 2026
    „Authorizations by a test user will expire seven days from the time of consent. If your OAuth client requests an offline access type and receives a refresh token, that token will also expire.“
  5. [5] Google: Using OAuth 2.0 to Access Google APIs: https://developers.google.com/identity/protocols/oauth2, checked November 17, 2026
    „The user has revoked your app's access.“
  6. [6] Google: Using OAuth 2.0 to Access Google APIs: https://developers.google.com/identity/protocols/oauth2, checked November 17, 2026
    „The refresh token has not been used for six months.“
  7. [7] Google: Using OAuth 2.0 to Access Google APIs: https://developers.google.com/identity/protocols/oauth2, checked November 17, 2026
    „There is currently a limit of 100 refresh tokens per Google Account per OAuth 2.0 client ID. If the limit is reached, creating a new refresh token automatically invalidates the oldest refresh token without warning.“
  8. [8] Google: Using OAuth 2.0 to Access Google APIs: https://developers.google.com/identity/protocols/oauth2, checked November 17, 2026
    „If an admin set any of the services requested in your app's scopes to Restricted (the error is admin_policy_enforced).“
  9. [9] Publit.Si docs: Connect YouTube: publit.si/docs/platforms/youtube
  10. [10] Google Cloud Help: Manage App Audience: https://support.google.com/cloud/answer/15549945?hl=en, checked November 17, 2026
    „Projects configured with a publishing status of In production are available to any user with a Google Account. A project's publishing status is considered In production after selecting the Publish app button.“
  11. [11] Google Cloud Help: When is verification not needed: https://support.google.com/cloud/answer/13464323?hl=en, checked November 17, 2026
    „Personal Use apps: If the app is for your personal use (fewer than 100 users), you and your limited number of users can continue using the app without going through verification(users will be allowed to click through “unverified app” warning screens during sign-in).“