AI fixes · n8n · Google OAuth · Self-hosted & own OAuth client
n8n Google Workflows Stop Every 7 Days? Your Google Credentials Expire Because the OAuth App Is Still in Testing — Publish It
The fast answer
First, check which side you are on — this guide is only for self-hosted n8n and for anyone using their own Google OAuth client (Custom OAuth2). If you are on n8n Cloud and connected Google Sheets or Calendar with the built-in Sign in with Google, stop here: that is Managed OAuth2, n8n’s own published Google app, and your connection should stay valid beyond seven days. For everyone else, the cause is Google, not n8n: an OAuth app whose publishing status is Testing gets refresh tokens that expire after 7 days — Google’s own words — so your workflows run fine for a week and then every Google node fails at once. The durable fix is two steps, in this order: (1) publish the app to Production in Google Auth Platform (Audience → Publish app), then (2) reconnect the credential once in n8n. Publishing alone does not revive the token you already have, and reconnecting alone buys you exactly seven more days. Do both, and the weekly stop ends. Fixes 1–4 below work in order: confirm the diagnosis, publish, reconnect, and know the stopgap if publishing is blocked.
What you are looking at, in plain words
When n8n talks to Google, it uses two tokens. The access token is short-lived — about an hour — and n8n refreshes it silently whenever it expires. The refresh token is the long-lived key that makes those silent refreshes possible: as long as it is alive, your workflows keep running for weeks with nobody signing in again. The 7-day trap kills the refresh token, not the access token — which is why everything works perfectly for a week and then stops all at once, with no warning while the clock is running.
Google’s rule, word for word from the “Refresh token expiration” section of its OAuth 2.0 documentation: “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).” n8n’s Google Sheets, Calendar, Gmail and Drive nodes request more than identity scopes, so the exception does not apply to them. n8n’s own documentation says the same thing from the n8n side, in its troubleshooting section: “For Google Cloud apps with Publishing status set to Testing and User type set to External, consent and tokens expire after seven days. … To resolve this, reconnect the app in the n8n credentials modal.” And Google’s Ads API documentation states the fix directly: “Your Google project’s publishing status is Testing so the refresh token expires every 7 days and receives an invalid_grant error. Go to the Google API Console and navigate to the OAuth consent screen. Then change the publishing status to In production to avoid the refresh token expiring in 7 days.”
That is the whole mechanism. You created a Google Cloud project, configured the OAuth consent screen as External, and left it in Testing — which is the default for an External app. You signed in once, Google issued a refresh token with a 7-day deadline, and n8n used it happily until the deadline passed. The next refresh attempt after the deadline got invalid_grant from Google (“Token has been expired or revoked”), and every workflow sharing that credential failed. The figure below shows the three setups at a glance; the table under it is every condition under which Google ends a refresh token, taken from the same Google page.
| Why the refresh token stops working | Google’s wording | What it means for you |
|---|---|---|
| Testing publishing status (the 7-day trap) | “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” | The cause of this guide. Fix: publish to Production, then reconnect once. |
| User revoked the app’s access | “The user has revoked your app’s access.” | Check the Google account’s third-party access page; re-grant if it was removed. |
| Token unused for six months | “The refresh token has not been used for six months.” | Any regular workflow run keeps the token alive; dormant credentials die quietly. |
| Password changed (Gmail scopes only) | “The user changed passwords and the refresh token contains Gmail scopes.” | Only tokens that contain Gmail scopes. A Sheets-only token is not covered by this row as written. |
| Too many live refresh tokens | “The user account has exceeded a maximum number of granted (live) refresh tokens.” — 100 per Google Account per OAuth 2.0 client ID; creating a new one “automatically invalidates the oldest refresh token without warning” | Repeated reconnects consume slots. Google’s workaround: limit clients authorised per account to 15 or 20. |
| Time-based access expired | “The user granted time-based access to your app and the access expired.” | Not part of a normal n8n sign-in; only if time-based access was granted. |
| Admin set a requested service to Restricted | “If an admin set any of the services requested in your app’s scopes to Restricted (the error is admin_policy_enforced).” | A Workspace admin policy, not the Testing clock. The error code tells it apart. |
| Google Cloud session-control policy | “For Google Cloud Platform APIs — the session length set by the admin could have been exceeded.” Calls fail with invalid_grant; error_subtype (for example invalid_rapt) distinguishes it. | Session lengths run 1–24 hours, not 7 days. An admin policy, not the Testing clock. |
About this table: every row is built from Google’s “Using OAuth 2.0 to Access Google APIs” page, “Refresh token expiration” section, read in full on 13 November 2026. One honest limit, stated plainly: Google’s list tells you every condition that can end a token, but the invalid_grant error itself does not say which condition fired — so the diagnosis in Step 0 and Fix 1 is checking the app’s publishing status, not reading the error. If the status is Testing and the failure landed about seven days after you connected, the 7-day rule is the cause. Two more things this guide deliberately does not state: no exact n8n error string is quoted, because n8n’s official documentation does not publish one; and no Google Trends figure, because none is verified for this item.
Step 0 — Work out which side you are on
- n8n Cloud, built-in sign-in, never entered a Client ID or Secret — you are exempt. In n8n, open the credential: if the authentication type is the built-in Sign in with Google and you never pasted in your own Client ID and Secret, you are on Managed OAuth2. n8n’s docs say Cloud users “don’t need any more setup in the Google Cloud Console or elsewhere” for it, and the 6 November 2026 community thread relays n8n staff’s clarification that Cloud uses n8n’s published Google app. Do not follow this guide’s fix — there is no app of yours to publish.
- Self-hosted n8n — this guide is for you. n8n’s docs are explicit: “Managed OAuth2 isn’t available for self-hosted n8n users. … You must create a custom OAuth2 single service credential. This means creating an app in the Google Cloud Console and connecting it to n8n with a Client ID and Client Secret.” That app is yours, and if it is still in Testing, its tokens expire in 7 days.
- n8n Cloud, but you switched the credential to Custom OAuth2 — this guide is for you too. n8n lets Cloud users change the authentication type with a dropdown and use their own Client ID and Secret. The moment you do, you are running your own Google OAuth app, and the Testing clock applies to it exactly as it does on self-hosted n8n.
- Confirm it in Google before you change anything. Open Google Cloud Console and go to Menu → Google Auth Platform → Audience (the page n8n’s docs link as the Audience page). Check two fields: Publishing status and User type. If the status is Testing and the user type is External, the 7-day rule applies to your app by definition — that is the diagnosis, and Fix 1 is the check that proves it.
The fixes, in order
- Fix 1 — Confirm the app is in Testing (two minutes, no changes yet). In Google Cloud Console, go to Menu → Google Auth Platform → Audience. Read the Publishing status at the top of the page: if it says Testing and the User type is External, you have found the cause — Google’s rule applies to exactly this combination. Also note the date you last connected the credential in n8n: if the workflows stopped about seven days after that date, the timing matches the rule as well. If the status already says In production, the 7-day trap is not your problem — work the ladder below instead, starting with revocation and the 100-token limit.
- Fix 2 — Publish the app to Production. On the same Audience page, under Publishing status, click Publish app. That one click changes the status from Testing to In production, and Google’s Ads API documentation states the result directly: change the publishing status to In production “to avoid the refresh token expiring in 7 days.” Two things to know before you click. First, do not confuse the two publish buttons: “Publish app” on the Audience page changes the publishing status; “Publish branding” on the Branding page only makes branding live — clicking the wrong one changes nothing about the 7-day clock. Second, if Publish app is greyed out, Google is telling you the Branding page is incomplete: the message reads “To publish your app, you must complete the configuration on the Branding page.” Complete Branding first — app name, user support email, developer contact email, and the homepage, privacy policy and terms-of-service links with the matching authorised domain. Google’s branding help page states the rule plainly: “These links are required for all external production apps.” Reports on Google’s own developer forum in October 2026 show the button staying greyed out until those Branding fields are filled in, and becoming available once they are. You do not need to submit the app for verification to publish: Google’s app-state overview shows a Published, External, Unverified app can be used by any Google user, with the app name and logo hidden, an unverified-app warning for sensitive or restricted scopes, and a hard cap of 100 total users — and Google’s verification page lists a personal-use exception for an app used only by you or a few people known personally to you. For a one-person n8n setup, that cap never bites.
- Fix 3 — Reconnect the credential once in n8n (after publishing, not before). In n8n, open Credentials in the left sidebar and open the Google credential your workflows use — do not create a new credential. Reconnecting the existing one preserves its credential ID, so every node that references it keeps working; a new credential would mean re-selecting it in every Google node. Click Sign in with Google, sign in as the same Google account, approve the scopes, and click Save. The order is the fix: publishing does not extend a token that was already issued while the app was in Testing — Google’s rule is that a Testing app “is issued a refresh token expiring in 7 days” — so the token minted by this reconnect, after the app is in Production, is the first one without the 7-day limit. Expect the “Google hasn’t verified this app” screen on this sign-in and click through it once (Advanced, then Go to the app): that is the unverified-app warning, covered by the personal-use exception in Fix 2, and you only see it when you reconnect, not on every run.
- Fix 4 — If you cannot publish right now, reconnect weekly as a stopgap (and only as a stopgap). Reconnecting the credential in n8n (Fix 3 on its own) restores the workflows immediately — n8n’s troubleshooting note prescribes exactly that as the immediate resolution. But the new token is issued while the app is still in Testing, so it expires in 7 days too, and the next failure lands about a week after the reconnect. Use the weekly reconnect only while publishing is blocked — for example while you sort out the Branding fields in Fix 2 — and do not mistake it for a fix. Do not create a fresh OAuth client each week either: it changes nothing about the clock — a new External app defaults to Testing too — and it only piles up tokens against Google’s overall refresh-token limit across all clients.
Warning — three traps that undo this fix. First, reconnecting before publishing: a token issued while the app was in Testing expires in 7 days no matter what you do afterwards, so a reconnect that happens before the publish buys exactly seven more days and then fails again. Publish first, reconnect second. Second, the two publish buttons: “Publish app” on the Audience page changes the publishing status; “Publish branding” on the Branding page only makes branding live. If you clicked the wrong one, the Audience page will still say Testing. Third, a greyed-out Publish app button is a Branding problem, not a dead end: complete the Branding page — app name, support email, contact email, homepage, privacy policy and terms links, authorised domain — and the button becomes available; Google’s own developer forum carried several reports of exactly this in October 2026, resolved by completing Branding. Do not start a Google verification review to unblock the button: verification is a separate process, it can take up to 10 days, and it is not required to publish.
Side note — named secondary source, not load-bearing: the statement that n8n Cloud’s built-in sign-in uses n8n’s published Google app comes from the 6 November 2026 n8n community thread (“Question urgent”), where a member relayed n8n staff’s clarification that Cloud uses n8n’s published Google app. No load-bearing claim in this guide rests on that thread: the rule that only Testing apps expire in 7 days is Google’s own documentation, and n8n’s docs state that Cloud Managed OAuth2 needs no Google Cloud Console setup. The October 2026 Google developer forum reports about the greyed-out Publish app button are likewise named only as the source for that contingency; the Branding requirement itself is Google’s own branding help page.
Prove it worked
Check the status first, then the credential, then the calendar. Open Google Auth Platform → Audience and confirm Publishing status now reads In production — if it still says Testing, Fix 2 did not land. In n8n, open the credential and confirm it shows as connected, then test-execute one Google node (for example, a Google Sheets “Get row(s)” or a Calendar read) and confirm it succeeds. Finally, write down the date of the reconnect: the proof is time, not a single run. Google provides no page that shows a refresh token’s countdown, so the confirmation is that your workflows are still running past day 7 with no reconnect. If they stop again on about day 7, work the ladder below — the usual cause is that the reconnect happened before the publish.
Still stopping after 7 days? Work this ladder in order
- It stopped again about 7 days after the fix. The reconnect happened before the publish. Publish first (Fix 2), then reconnect once more (Fix 3) — the token issued after publishing is the first one without the limit. Fix 2, then Fix 3.
- The Audience page still says Testing. The publish did not land — either you clicked “Publish branding” on the Branding page instead of “Publish app” on the Audience page, or the button was greyed out and Branding is incomplete. Fix 2.
- Publish app is greyed out. Complete the Branding page: app name, user support email, developer contact email, homepage, privacy policy and terms-of-service links, and the matching authorised domain. Google requires those links for all external production apps. Fix 2.
- Nodes still fail but the credential looks connected. You created a new credential instead of reconnecting the old one. Your nodes still point at the old credential. Reconnect the credential your nodes already use (Fix 3), or re-select the new credential in every Google node — reconnecting the old one is the shorter path.
- You are on n8n Cloud Managed OAuth2 and it still dropped. That is not the 7-day trap. Check Google’s other conditions: was the app’s access revoked (check the Google account’s third-party access page), did the Google password change on a token with Gmail scopes, or did the account pass 100 live refresh tokens for the client? FAQ 7 lists all of them.
- “Google hasn’t verified this app” stops you at reconnect. That is the unverified-app screen, not a block. Click Advanced, then Go to the app: the personal-use exception covers a one-person setup, and no verification review is needed to publish or to reconnect. FAQ 5.
- You are on a Workspace account and tokens die faster than 7 days. A Workspace admin’s session-control policy (1–24 hour sessions) or a Restricted service setting can also end tokens, with
invalid_grant— session control carries anerror_subtypesuch asinvalid_rapt, and a Restricted service fails withadmin_policy_enforced. Those are admin policies, not the Testing clock, and only your Workspace admin can change them.
Mistakes that make it worse
- Reconnecting the credential every week and calling it fixed — each reconnect buys exactly 7 days while the app stays in Testing.
- Reconnecting before publishing, then wondering why it stopped again a week later — the token was issued under Testing and keeps its 7-day limit.
- Clicking “Publish branding” instead of “Publish app” — branding goes live, the status stays Testing, and the clock keeps running.
- Creating a brand-new credential instead of reconnecting the old one — your nodes still point at the old credential and keep failing.
- Creating a fresh OAuth client each week — it changes nothing about the clock (a new External app defaults to Testing too) and only piles up tokens against Google’s overall refresh-token limit across all clients.
- Starting a Google verification review to unblock publishing — verification is separate, can take up to 10 days, and is not required to publish for personal use.
- Following this fix on n8n Cloud’s built-in sign-in — there is no app of yours to publish, and Managed OAuth2 is exempt.
- Assuming the error message names the cause —
invalid_grantdoes not distinguish expiry from revocation, so check the publishing status instead of reading the error.
Frequently asked questions
I’m on n8n Cloud and used the built-in Sign in with Google. Do I have this problem?
No — not this one. n8n Cloud’s built-in sign-in is Managed OAuth2: n8n’s docs say Cloud users click Sign in with Google and need no setup in Google Cloud Console, and in the 6 November 2026 n8n community thread a member relayed n8n staff’s clarification that Cloud uses n8n’s published Google app, so a regular Gmail account should stay connected beyond seven days, with n8n refreshing the access tokens automatically. The seven-day expiry applies to External OAuth apps left in Testing mode — your own app, in other words. If your Cloud connection still drops, it is one of Google’s other causes (revocation, a password change, or too many tokens), not the Testing clock. Note: if you are on Cloud but switched the credential to Custom OAuth2 with your own Client ID and Secret, you are running your own app and this guide does apply to you.
Why exactly seven days — where does Google say that?
Google’s “Using OAuth 2.0 to Access Google APIs” page, in the “Refresh token expiration” section, says: “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).” n8n’s Google Sheets and Calendar nodes request more than identity scopes, so the exception does not apply to them. The token is issued when you consent, so the failure lands about a week after you connected — at whatever hour you signed in — and every Google node that shares the credential fails at once.
Do I have to get Google to verify my app before I can publish it?
No. Publishing to Production and verification are separate steps. Google’s app-state overview shows a Published, External, Unverified app can be used by any Google user — the trade-offs are that the app name and logo are not shown, an unverified-app warning appears for sensitive or restricted scopes, and a hard cap of 100 total users applies. Google’s verification page lists a personal-use exception: if you are the only user of your app, or it is used by only a few users all known personally to you, you do not need to submit it for review — you advance through the unverified-app screen instead. Sensitive-scope verification, if you ever pursue it, can take up to 10 days. For a one-person n8n setup, publish first and do not start a verification review you do not need.
I published the app, but my workflows stopped again a week later. Why?
Almost always, the reconnect happened before the publish. A refresh token issued while the app was in Testing expires in 7 days — that is Google’s rule as written — so a token minted before you published still dies on its original schedule. Publish first, then reconnect once in n8n (Fix 3), and the new token is a Production token. The other common cause is creating a brand-new credential instead of reconnecting the old one: your nodes still point at the old credential, so they keep failing while the new one sits unused. Reconnect the credential your nodes already use.
What do I do about the “Google hasn’t verified this app” screen when I reconnect?
Expect it and click through it once. After you publish an unverified app, Google shows the warning on the consent screen because the app has not completed verification. Google’s own personal-use exception covers this case: if you are the only user, or one of a few users all known personally to you, you do not need to submit the app for review — you advance through the unverified-app screen (Advanced, then Go to the app) and grant your own account access. You only see the screen when you reconnect, not on every workflow run.
Can I just reconnect the credential every week instead of publishing?
You can, as an emergency restore — but it is a weekly ritual, not a fix. A fresh token issued while the app is still in Testing expires in 7 days, so the next failure lands about a week after the reconnect, at the same hour. n8n’s own troubleshooting note prescribes reconnecting as the immediate resolution, but it does not present it as durable. Every reconnect also consumes one of Google’s 100 live-refresh-token slots per Google Account per OAuth 2.0 client ID, and if that limit is reached Google invalidates the oldest token without warning. Publish the app once, reconnect once, and the ritual ends.
What else can make a Google refresh token stop working?
Google lists seven other conditions on the same page as the 7-day rule: the user revoked the app’s access; the token was unused for six months; the user changed passwords and the token contains Gmail scopes; the account exceeded the maximum number of live refresh tokens (100 per Google Account per OAuth 2.0 client ID); the user granted time-based access and it expired; a Workspace admin set a requested service to Restricted (the error is admin_policy_enforced); or a Google Cloud session-control policy’s session length was exceeded (the call fails with invalid_grant, with an error_subtype such as invalid_rapt). Publishing to Production removes only the Testing 7-day condition — the others still apply, which is why the ladder below checks revocation and admin policy before concluding the fix failed.
Would a Google service account avoid the seven-day expiry altogether?
Yes — a service account has no user refresh token, so there is no seven-day clock, and Google’s 100-refresh-token limit does not apply to service accounts. But it is not the easy path. n8n’s own docs say using service accounts is more complex than OAuth2 and that for most use cases OAuth2 is the better option. A service account is also a separate identity: it can only touch files explicitly shared with its email address, and n8n documents that Google no longer allows service accounts created after 15 April 2025 to access My Drive — they only have access to shared drives. Publish your OAuth app and reconnect once; that is the fix n8n’s docs point at, and it keeps the sign-in you already have.
Sources
Google — Using OAuth 2.0 to Access Google APIs, “Refresh token expiration” (“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).”; “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.”; “The refresh token has not been used for six months.”; “The user changed passwords and the refresh token contains Gmail scopes.”) · Google — Google Ads API: Common errors, invalid_grant row (“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.”; “Your Google project’s publishing status is Testing so the refresh token expires every 7 days and receives an invalid_grant error. Go to the Google API Console and navigate to the OAuth consent screen. Then change the publishing status to In production to avoid the refresh token expiring in 7 days.”) · Google — OAuth app state overview (Testing / External: only allowlisted test users, hard cap of 100 test users; Published / External / Unverified: any Google user can access, app name and logo not displayed, unverified-app warnings for sensitive or restricted scopes, hard cap of 100 total users; a Workspace admin marking an app “Trusted” overrides the 7-day refresh-token expiration limit for Testing apps) · Google — Configure the OAuth consent screen and choose scopes (“In the Google API Console, go to Menu > Google Auth platform > Branding.”; Branding, Audience and Data Access pages; “If you selected External for user type, add test users” under Audience) · Google — Sensitive scope verification (“The sensitive scope verification process can take up to 10 days to complete.”; personal-use exception: “if you are the only user of your app or if your app is used by only a few users, all of whom are known personally to you” you do not need to submit it for review) · Google — Manage OAuth App Branding (“These links are required for all external production apps.”; “If all checks pass, the status will change to Ready to publish. You must then click the Publish branding button to make the new branding live on the OAuth consent screen.”) · Google — Manage App Audience (“The publishing status determines if your application is in test or production mode.”; new-user cap of 100 new users in total for apps presenting the unverified-app screen) · n8n — Google OAuth2 single service (“n8n Cloud users can use Managed OAuth2” for Google Sheets, Calendar, Gmail, Drive and others; “To use Managed OAuth2, click Sign in with Google in the credentials screen. You don’t need any more setup in the Google Cloud Console or elsewhere.”; “Managed OAuth2 isn’t available for self-hosted n8n users. … You must create a custom OAuth2 single service credential.”; “For Google Cloud apps with Publishing status set to Testing and User type set to External, consent and tokens expire after seven days. … To resolve this, reconnect the app in the n8n credentials modal.”; “If you select External, your app will default to Testing mode.”) · n8n — Google Service Account (“Using service accounts is more complex than OAuth2.”; “For most use cases, OAuth2 is a better option.”; “Google no longer allows Service Accounts created after April 15, 2025 to access my drive. Service Accounts now only have access to shared drives.”; “A Service Account can’t access Google Drive files and folders that weren’t shared with its associated user email.”) · n8n community — “Question urgent” (6 November 2026), named secondary source only (a member relayed n8n staff’s clarification that Cloud uses n8n’s published Google app and a regular Gmail account “should stay connected beyond seven days”, with n8n refreshing the access tokens automatically; “The seven-day expiry mentioned above applies to External OAuth apps left in Testing mode.”) · Google Developer forums — “Publish app disabled for a personal-use Desktop OAuth app” (October 2026), named secondary source only (the Audience page disables “Publish app” with “To publish your app, you must complete the configuration on the Branding page.”; resolved after adding a homepage, privacy-policy and terms-of-service URLs and the authorised domain).
Did this fix work for you?
Your reaction is stored only in your own browser — it is not sent to us.