Google Oauth

I’m using the Google Sheets node in n8n, and my OAuth token keeps expiring. Every time it stops working, I have to manually reconnect my Google account in the n8n credentials panel. The error I get is:

“The provided authorization grant or refresh token is invalid, expired, revoked, does not match the redirect URI, or was issued to another client.”

It looks like n8n is not receiving or storing a valid refresh token from Google, so the access token can’t auto-refresh. I need help identifying why the refresh token isn’t sticking. My suspicion is either a redirect URI mismatch, the OAuth client being in Testing mode, or Google not issuing a refresh token at all.

Can you help me troubleshoot how to make the Google Sheets credential stay authenticated permanently without needing manual reconnection?

Hey @sarinah !

If your Google Cloud OAuth consent screen is set to Testing and the user type is External, refresh tokens and consent expire after 7 days.

This is a Google restriction.

To resolve thiis, you must set your OAuth consent screen s ‘Publishing’ status to ‘Production’.

This willl allow refresh tokcens to persist and prevent freqvuent disconnections.

P.S You do not need to verify the app for this to woork, just publish it to production mode.

Cheers!

1 Like

Hey @sarinah i found a solution.

The Solution: You need to move your app to “Production.”

For personal use, you can push the app to Production, ignore the verification requirements, and still get permanent tokens. You just have to accept a “scary” warning screen.

Here is the exact protocol to fix this forever:

Step 1: The “Publish” Button

Go to your Google Cloud Console > APIs & Services > OAuth consent screen.

Under “Publishing status”, click the button that says PUBLISH APP.

Confirm the dialog. Your status will change from “Testing” to “In production”.

Step 2: Ignore the Bureaucracy

Google will immediately shout at you that your app needs verification. It might ask you to submit documents or a privacy policy.

Do nothing. You can leave the verification status as “Needs Verification” or “Unverified” indefinitely.

Step 3: Re-authenticate One Last Time

Go back to n8n and open your Google credentials.

Click “Sign in with Google” again.

The Warning: Because your app is now “Production” but “Unverified,” Google will show a scary screen saying “Google hasn’t verified this app.”

The Bypass: Click Advanced (in the bottom left) → Go to [Your App Name] (unsafe).

Grant the permissions.

The Result: You now have a refresh token that does not expire.

Why is this safe? Because you are the developer and you are the user. You are warning yourself about your own app.

The Limit: Unverified production apps are limited to 100 users. Since you are the only user (or your team is small), this limit is irrelevant.

Enjoy your permanently connected automation.

COPIED! Hope this helps you mate

2 Likes

thank you @Parintele_Damaskin

i will do this and get back to you

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.