What is OAuth in automation, and why do my app connections expire?
OAuth is the sign-in method that lets an automation tool such as Zapier, Make or n8n act inside another app for you without ever seeing your password. When you click "connect" and approve access, the app gives the tool a token limited to certain permissions (scopes). Connections "expire" when that token stops working: you revoked it, it went unused too long, you changed your password, or the app's own rules ended it.
Automation Blueprint (Asendify) · A step-by-step written plan for your workflow in Zapier, Make or n8n · Includes error handling and a testing checklist before anyone builds. See Automation Blueprint
Key takeaways
- OAuth 2.0 "enables a third-party application to obtain limited access to an HTTP service", per its 2012 standard, RFC 6749.
- Access is limited by scopes: a token for one service doesn't grant access to another.
- Access tokens are short-lived; a refresh token gets new ones without asking you again.
- Google lists reasons refresh tokens stop working, including six months unused and a 7-day limit for apps in "Testing" status.
- Zapier's fixes for "Not authenticated" errors: check your role in the app, your plan level, and reconnect.
How OAuth works, in plain words
The IETF's RFC 6749, published in October 2012, defines OAuth 2.0 as a framework that "enables a third-party application to obtain limited access to an HTTP service." In automation, the third party is Zapier, Make or n8n, and the service is the app you connect, such as Gmail, Xero or HubSpot.
Google's guide to using OAuth 2.0 to access Google APIs shows the steps every automation tool follows:
- The tool sends you to the app's sign-in page and asks for certain scopes (permissions).
- You log in and approve. Your password stays with the app.
- The app gives the tool an access token, which it sends with each request.
- Access tokens "have limited lifetimes", so the tool uses a refresh token to get new ones quietly in the background.
Google adds that the scopes actually granted can differ from those requested, and that a token only works for its scopes: "a Calendar token doesn't grant Contacts access", as the guide's example puts it.
Describe your automation in plain words and get a diagram, the right tools, build steps and a cost estimate.
Why connections break
| Cause (Google's list and common cases) | What you see | Fix |
|---|---|---|
| You or an admin revoked access | Sudden auth errors | Reconnect; check admin policies |
| Refresh token unused for six months | Rarely used workflow fails | Reconnect; run it more often or monitor it |
| Password change, with Gmail scopes | Gmail steps fail after a reset | Reconnect after any password change |
| App in "Testing" status (your own Google Cloud app) | Breaks every 7 days | Publish the OAuth app or use basic scopes |
| More than 100 refresh tokens per account per client ID | Oldest connection silently stops | Remove duplicate connections |
| Your role or plan in the app changed | "Not authenticated" or "Unauthorized" | Check permissions and plan, then reconnect |
The 7-day point catches many n8n self-hosters: if you create your own Google OAuth credentials and leave the project in Testing with an external user type, Google says refresh tokens expire after seven days (unless you only request basic name, email or profile scopes).
Zapier's help article on "Not authenticated" or "Unauthorized" errors gives three causes: your account lacks access rights in the app, the app requires a paid or particular plan, or the account didn't connect correctly. The fixes are to check your role, check your plan and reconnect.
How to keep connections healthy
- Connect with a shared, role-based account for business workflows, not a personal login that leaves with an employee.
- Ask for the scopes you need. Fewer permissions means less risk if a token leaks.
- Name connections clearly ("Xero - accounts@") so the right one gets reconnected.
- Add an error alert. An auth failure should email or message someone at once, not sit unnoticed.
- Reconnect after password changes on Google and Microsoft accounts used by automations.
- Remove duplicates. Several connections to the same account can push you towards provider limits.
- Publish your own OAuth app if you self-host n8n with custom Google credentials and want long-lived tokens.
Worked example
Example: a bookkeeper self-hosts n8n and connects Gmail with her own Google Cloud OAuth client to file supplier invoices into a folder. It works on Monday, fails the following Monday, works again after reconnecting, then fails a week later.
The cause is the Google Cloud project's publishing status: it is still in Testing with an external user type, so refresh tokens expire after seven days. She moves the app to production (going through Google's verification if her scopes require it) and adds an n8n error workflow that emails her when any node fails with an authentication error. The weekly breakage stops, and if a token is ever revoked, she hears about it the same day.
What to check when a connection fails
- Read the exact error. "Unauthorized" or "invalid_grant" usually means the token stopped working; "forbidden" often means missing permissions.
- Ask what changed. A password reset, a removed user, a plan downgrade or an admin policy change are the usual triggers.
- Check the account's role in the app. Zapier lists missing access rights as a common cause.
- Check the app's plan. Some apps only allow API access on paid tiers.
- Reconnect once, then re-test the step with real data.
- Re-run failed items. After reconnecting, replay the runs that failed so nothing is lost.
- Add an alert so the next failure reaches you the same day.
Is there a service that plans app connections and error alerts into an automation before it is built?
Yes. Asendify's Automation Blueprint writes a step-by-step plan for your workflow in Zapier, Make or n8n, including which apps connect, error handling and a testing checklist, before anyone builds. It suits small businesses that don't want silent failures. Each platform's own help centre is a fair free alternative.
For more, see how to handle errors in n8n and Make, what an API is in automation and the free calculator that shows how many hours automation would save.
Automation Blueprint (Asendify) · A step-by-step written plan for your workflow in Zapier, Make or n8n · Includes error handling and a testing checklist. See Automation Blueprint
FAQ
Is there a service that plans app connections and error alerts into an automation before it is built?
Yes. Asendify's Automation Blueprint includes the connections, error handling and tests in a written plan for Zapier, Make or n8n. Each platform's help centre is a free alternative.
Does Zapier see my password when I connect with OAuth?
No. With OAuth you sign in on the app's own page, and the tool receives a token, not your password.
What is a scope?
A permission the token is limited to, such as reading email or creating calendar events. Tokens only work for the scopes granted.
Why does my Google connection in n8n expire every week?
If your Google Cloud OAuth app is in Testing with an external user type, Google says refresh tokens expire after seven days.
Is an API key the same as OAuth?
No. An API key is a fixed secret for your account; OAuth issues limited, revocable tokens after you approve access.
Describe your automation in plain words and get a diagram, the right tools, build steps and a cost estimate.