createAuth(), and the framework handles the full flow: authorization redirect, callback handling, PKCE, token exchange, and account linking.
Setup
Provider configuration
All providers share the same config interface:Default scopes
Account linking
When a user signs in via OAuth, the system follows a three-path resolution:- Existing link found — The provider account is already linked to a user. Sign them in.
- Trusted email match — The provider verifies the email (Google OIDC). If a user with that email exists, auto-link the provider account and sign in.
- No match — Create a new user account and link the provider account.
GitHub and Discord don’t verify email ownership at the OAuth level, so they never auto-link to
existing accounts. Each GitHub/Discord sign-in creates a new account unless a link already exists
in the
OAuthAccountStore.Required configuration
Encryption key
OAuth state is stored in an encrypted cookie (AES-256-GCM). You must provide an encryption key:OAuthAccountStore
The account store tracks which provider accounts are linked to which users:Redirect configuration
Control where users land after OAuth:Security
Environment variables
UsecreateEnv() to validate OAuth credentials at startup:
OAuth-only users
Users created via OAuth have anull password hash. If they attempt email/password sign-in, the auth system runs a timing-safe dummy bcrypt comparison — same response time, always fails. This prevents user enumeration via the sign-in endpoint.