Have to re-connect Google OAuth

I have a workflow that uses OAuth to write to a Google Spreadsheet. Works fine - at first.
But at some stage it just stops working and I have to re-connect it.

What’s going on? Why isn’t the token getting renewed?

{
"body": {
"error": "invalid_grant",
"error_description": "Token has been expired or revoked."
},
"code": "EAUTH"
}

This is with n8nio/n8n:0.144.0

Hi @tcurdt, does this stop working after 7 days by any chance and are you using a test scenario?

As per Google’s OAuth documentation renewing only works for up to seven days in these cases:

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.

1 Like

Thanks for the pointer - that could actually be the cause.
That’s not mentioned when creating the OAuth app.

(Grr!)

So for this to work I do have to publish this as an external app, I guess?

Maybe I should have kept using the service account credentials.

(Sigh)

Yes, Service Account credentials can make some things easier :wink:. Alternatively, you should also be able to make this an Internal application (if you’re a Google Workspace user with a Google Cloud Organization) according to the documentation linked above.

Yeah, unfortunately it seems my account does not allow me to create “internal” applications. A bit of a bummer. I guess it’s back to using a service account then.

Thanks for pointers.

1 Like

You are most welcome, sorry I didn’t have better news to share here