Google Drive OAuth2 invalid_client error in self-hosted n8n Docker Copy

Hi n8n Community,

I’m running n8n v2.43.7 locally through Docker at http://localhost:5678.

I’m trying to connect Google Drive using OAuth2, but authentication repeatedly fails with:

invalid_client — Client authentication failed.

My configuration:

  • Google Drive API enabled

  • OAuth client type: Web application

  • OAuth consent screen: External / Testing

  • My Google account added as a test user

  • Redirect URI: http://localhost:5678/rest/oauth2-credential/callback

I have already verified the redirect URI, created a fresh OAuth client, entered its Client ID and Secret into n8n, and attempted authentication multiple times.

Previously, an older OAuth client produced 401 deleted_client. The new client still produces invalid_client.

The Google Drive node subsequently shows Unable to sign without access token.

Could someone help identify whether this is an OAuth client configuration problem, token-exchange failure, or an n8n Docker configuration issue?

I would like to preserve my existing research automation workflow.

error message : Error: Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method).

More details

invalid_client

Failed to connect. The window can be closed now.

Thanks in advance.

That error comes from Google rejecting the client secret during the token exchange, not from the redirect URI, because a redirect problem shows up as redirect_uri_mismatch instead. Generate a new secret on the OAuth client, clear the n8n field completely and paste it again, since a trailing space or newline from copying is a common cause. Also make sure the Client ID and secret come from the same client, in the same project where the Drive API is enabled. New OAuth clients can take a few minutes to start working, so if it’s brand new, wait a bit and try again with a fresh n8n credential rather than editing the old one.

saji_john,

One thing worth ruling out: n8n builds the OAuth redirect from N8N_EDITOR_BASE_URL / WEBHOOK_URL, not from the address in your browser, so check that the “OAuth Redirect URL” shown in the credential is exactly what’s registered in Google. I hit invalid_client myself on a self-hosted setup and only got it working after serving n8n on a public-TLD HTTPS domain; that may not be your cause with localhost, but it’s worth checking. Also re-paste the client ID and secret fresh from the downloaded JSON, since the secret pairing is the other usual culprit.

Hope this helps!

Cheers,

-Awzy11

Hi saji_john, I’ve set up Google OAuth on self-hosted n8n more times than I can count, and invalid_client at this stage has a very specific meaning, so we can narrow this down quickly.

The key distinction: this error comes back from Google’s token endpoint, after you click through the consent screen — i.e. during the authorization-code-for-token exchange. If the redirect URI were wrong, you’d get redirect_uri_mismatch on the consent page itself, before any exchange happens. So your redirect URI registration is fine. What Google is rejecting is the client_id/client_secret pair that n8n sends.

Your deleted_client history is the biggest clue. You created a fresh OAuth client, but in my experience the failure persists for one of these reasons:

  1. Stale secret pairing. Make sure the Client ID and Client Secret in the n8n credential both belong to the new client — it’s remarkably easy to paste the new ID alongside the old secret, or to keep editing a credential that the Google Drive node no longer references. Compare them character-by-character in the GCP console, and watch for a trailing space when pasting.

  2. Recreate, don’t edit. Delete the n8n credential entirely and create a new one instead of editing the fields in place. Stale encrypted values can survive an edit, especially after a previous attempt failed mid-flow.

  3. The consent-screen “Testing” trap. Unpublished (Testing) apps have their refresh tokens expire after 7 days. That surfaces later as invalid_grant, not invalid_client — but once you get past this, either publish the app or expect the token to quietly stop refreshing. For a research automation you depend on, that’s the next fire to prevent.

As Awzy11 mentioned, n8n builds the OAuth callback from N8N_EDITOR_BASE_URL / WEBHOOK_URL — but since you got past consent, that’s not your blocker here. And “Unable to sign without access token” on the node is just the downstream symptom: no token was ever stored.

Check the Docker logs at the exact moment of the exchange — the full token-endpoint response usually includes an error_description that names the failing field. Nine times out of ten in my setups, it’s a mismatched ID/secret pair after recreating a client. Let me know what the log says and I can pinpoint it further.