Your agent can build the integration.See the two prompts
Documentation navigation

Profiles, tokens and sessions

Use a project-scoped identity and let your application own its authenticated session.

On this page

Identity is scoped to a project

Use the normalized profile’s subject as your application identity key. Google and GitHub identities remain separate, even when their email addresses happen to match. Names, usernames, email and avatars are nullable; emailVerified is a separate signal.

Managed sessions

The managed backend router verifies login and creates an encrypted, expiring HttpOnly session cookie (SameSite=Lax, Secure on HTTPS). Browser getProfile() reads the verified profile through your backend; logout() clears the cookie. Default session lifetime is one day. Quickstart · Custom sessions and immediate revocation.

Your application owns its user database and authorization rules. A profile displayed in browser JavaScript is not proof of authentication to a protected backend route; that route reads the SDK-authenticated session or your own session store.

For manual integrations, completeLogin({loginAttempt}) returns a verified profile on success. Only then create and rotate your own session. Pending is not authentication; terminal results are one-time. The managed router performs those steps for you.

Advanced: the profile token is an AnyOAuth token

The exchange returns an opaque profile-only token. It is not a provider access token or an OpenID Connect ID token. AnyOAuth never returns upstream provider credentials to customer applications. The schema-generated exchange reference describes its exact shape and lifetime.

Existing code-based integrations use getProfile({accessToken}) to read the identity and revokeProfileToken({accessToken}) to retire that fifteen-minute token. These methods do not grant access to Google or GitHub APIs.

Your application owns its session

After receiving the profile, your backend creates its own secure session. Destroy that server session and expire its cookie through your application’s same-origin POST logout route. Revoking an AnyOAuth profile token does not retire application sessions. Clean-callback login needs only application-session logout.

Handle errors and retries

On failure, remove the saved login attempt and show an explicit start-again action. For an ambiguous completeLogin retrieval failure, start a new login rather than automatically retrying a result that may already have been consumed. Existing code-exchange integrations follow the same rule for single-use codes. Infrastructure may return a non-JSON error; SDKs expose structured protocol/transport errors without raw request details.