Connect Google services to n8n with OAuth2

Authorize n8n to use a service such as Gmail or Google Drive and test the connection in a workflow.

Tooln8n
Format
5 minEnglish
Updated 5 min

What you will create

Connect a Google service to n8n and check that your workflow uses the correct account and document. OAuth grants an application access without giving it your Google password. A successful connection does not mean every file is accessible: the account, permissions and target resource still matter.

Before you start

Choose one initial use case, such as reading a test sheet. Record the intended Google account and prepare a document without confidential data. Make sure you are allowed to connect the service; an organization may require administrator approval. Do not request unrelated access just to make an error disappear.

Step-by-step

  1. Open the credentials for your Google node. On n8n Cloud, prefer Managed OAuth2 when available: managed Google sign-in avoids custom client setup.
  2. If Custom OAuth2 is needed, prepare the Google Cloud project, required APIs and consent screen. For Sheets, n8n documentation also requires Drive API.
  3. Create a Web application OAuth client. Register the exact redirect URL supplied by n8n. Put the client ID and secret only in the designated secure credential fields, never in workflow text.
  4. Connect the intended account and examine requested permissions before accepting them. Stop if you do not recognize the application or understand its access request.
  5. Select this connection in the node and run an initial read-only check against the test document.

Example to adapt

Create a sheet named “Connection test” with two columns: marker and value. Add the row OAUTH-TEST, 17. Have the workflow read this sheet and compare its output with both cells. This exercise avoids starting with an email send or a change to an important document.

Keep a short record without secrets: connection name, expected account, service, test document and check date. Do not copy tokens or client secrets into it.

Check your result

  • The selected account is the one with access to the document.
  • The result contains OAUTH-TEST and 17, not a similarly named document from another workspace.
  • No write, delete or message-sending step has been added to the read-only test.
  • Granted access matches the intended use, and no secrets appear in shared documents.

Common problems

redirect_uri_mismatch: compare the exact callback address on both sides. Connected but file missing: check the account and file access before recreating credentials. Access denied: have the application audience, test users and organization rules checked. Do not bypass an unfamiliar warning. A revoked or expired connection may need fresh authorization; do not assume it will work permanently.

Next steps

Explore the n8n overview, then prepare a form connected to Google Sheets after validating your connection.