OAuth flow
OAuth is the standard protocol for letting a third-party application access your accounts (Gmail, Calendar, Stripe) without seeing your password. The user grants scoped permission via a redirect-and-callback flow; the app receives a token usable for the granted scopes.
Why it matters
OAuth is the dominant authentication pattern for connecting AI agents to the user's real accounts. Without OAuth, the agent would need the user's password (a security disaster) or the user would have to manually copy data between services (a usability disaster). OAuth solves both: the user authorizes the agent at the source SaaS, the source SaaS hands the agent a scoped token, and the agent uses that token to read/write only what was authorized.
The OAuth flow has a few standard shapes:
- OAuth 2.0 authorization code flow. The dominant pattern. User redirects to the source SaaS; logs in; grants scopes; redirects back to the agent with an authorization code; agent exchanges code for an access token (and optionally a refresh token).
- OAuth 2.0 PKCE. A variant for public clients (mobile apps, single-page apps). Adds a proof-key to defend against intercepted authorization codes.
The user experience: a click, a redirect, a "yes I authorize," another redirect, and the agent is connected. The whole flow is seconds.
The hard parts for the agent operator:
- Token rotation. Refresh tokens expire; the agent has to refresh access tokens before they expire to keep tools working.
- Scope management. Different operations need different scopes; minimizing the requested set is good security hygiene.
- Revocation handling. If the user revokes access at the source, the next call returns 401; the agent should handle gracefully and prompt re-auth.
How Ajeris handles this
Ajeris uses OAuth 2.0 to connect to all 21 personal-side integrations (Gmail, Calendar, Drive, Plaid, Spotify, Hue, Uber, Apple Music, Shopify, QuickBooks, Xero, Square, Slack, HubSpot, Notion, GitHub, Google LSA, etc.). The user clicks a connect button; the redirect-and-callback flow runs; tokens land in the agent's encrypted credential store.
The agent handles token refresh automatically. Scopes are minimal (the agent requests only what it needs for the user's intended use case). Revocation triggers a re-auth prompt the next time the agent tries to use the tool.