Can one use Google Sheets longer than 7 days in "Test mode" without manual reconnecting

Describe the problem/error/question

We are using n8n for some internal automations, especially the Google Sheets Node for reading and writing to a Sheet.
In Google Cloud Console, we currently set the app in “Test mode”. But with that test mode, the refresh token expires every 7 days and we need to manually reconnect the credentials in n8n. A solution would be to “publish” the app in Google Cloud Console. But as we use these scopes:

  • /auth/spreadsheets
  • /auth/drive
  • /auth/drive.file
  • /auth/drive.metadata
  • /auth/drive.metadata.readonly
    We would be required to make a CASA-safety-audit because of the /auth/drive scope which is restricted. (Does one even need that one? Or is spreadsheets enough?). We cannot make the app “internal” as we don’t have a Google-Workspace-Account.
    So is there a way to set this up in Test mode or any other solution, that would not require us to manually reconnect every week/publish the app with /auth/drive scope?

What is the error message (if any)?

The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client


Information on your n8n setup

  • n8n version: 2.10.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux/Debian
1 Like

Hi @ai-cr Welcome!
What you are using is a very common behavior of google app services which are not published. Just publish your google cloud app to “In Production” status.

See this for more common issues like that:

On Google Cloud Console, make sure you change the Publishing Status to ‘In Production’

Hey, easiest fix here is to just use a Google Service Account instead of OAuth. No refresh tokens to deal with at all so nothing expires. You just share teh sheet with the service account email and youre good, no publishing or CASA audit needed. n8n supports it natively under the credential type dropdown