Gmail Trigger: Built-in Google OAuth token expired/revoked

Describe the problem/error/question

My Gmail Trigger node stopped working. The built-in Google OAuth authorization (using “Sign in with Google” on n8n Cloud) has become invalid. The workflow was working previously but now fails on every poll.

I didn’t change password or revoked app access. After re-authenticating via “Sign in with Google” the trigger works, but I don’t understand why it stopped working or if it will stop again.

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.

Full error:

{
  "errorMessage": "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.",
  "errorDetails": {
    "rawErrorMessage": [
      "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."
    ],
    "httpCode": "EAUTH"
  }
}

Please share your workflow

Not relevant - this is a credential/authentication issue, not a workflow logic issue. The Gmail Trigger node fails before any workflow execution.

Share the output returned by the last node

N/A - the trigger itself fails to authenticate.

Information on your n8n setup

  • n8n version: 1.99.1

  • Database: N/A (Cloud)

  • n8n EXECUTIONS_PROCESS setting: N/A (Cloud)

  • Running n8n via: n8n Cloud

  • Operating system: N/A (Cloud)


hello @albertocabasvidani

Not sure, but maybe the previous credentials is expired. Usually, an API token is valid only for a specific time

Is this the case also with Gmail nodes in n8n Cloud?

That would be an issue, how can I know when a Gmail trigger stops working?
In this case, I didn’t receive any error notification, the trigger didn’t trigger at all.

Hi @albertocabasvidani,

What @barn4k referred to is correct. When using gmail oauth, you need to re-auth after some time again as the tokens expires and does not auto refresh. Ideally you need to use a Service Account which never expires, however this will only work on a Google Workspace account which is a paid service for businesses. Public gmail.com accounts are not supported for service accounts.

However if gmail.com is your only option, to get notified when your gmail node fails due to a token expiry, I would advise you to create a workflow and set the Error Trigger. Remember to point your workflow to the error workflow so it can catch errors. Then use something like Telegram to send you errors to your phone.

If this is still a problem, then I would highly recommend signing up for a MailRelay account (provides 80 000 free emails a month) and send emails like this. MailRelay provides an API which you can call via the http node. I ran into a similar issue and decided to switch from gmail to this option.

Transactional emails like notifications etc should generally be sent using a bulk emailing service instead of gmail as Google will likely rate limit you on top.

@Wouter_Nigrini, I’m using n8n Cloud’s pre-verified Gmail credential, not my own OAuth app.

Doesn’t n8n handle token refresh automatically in this case?

Im not 100% sure on that, but on GCP, did you have your app verified? I suspect the tokens expire when using test users and not a verified app

@Wouter_Nigrini,

Thanks for following up! I think there might be a misunderstanding here. I’m using n8n Cloud, not a self-hosted instance. On n8n Cloud, I don’t need to create or configure my own Google Cloud app at all.

When I set up the Gmail credential, the system simply prompts me to log in with my Google account. n8n handles the OAuth connection through their own pre-verified app on our behalf. There’s no GCP console, no app creation, no verification process on my end.

So the question is: shouldn’t n8n’s built-in OAuth app handle token refresh automatically since it’s their verified application managing the connection?