Upgrade to 4.0Changelog
Get started

Choose your AuthEndpoints sign-in setup

Match a client and a sign-in method to one AuthEndpoints call, then open the page that shows that call.

Start with the quick start when a browser signs in with a password and a cookie. Use this page when that is not the setup you need.

The password facade is AddPasswordAuth and MapPasswordAuth. It maps one session under /auth. Cookie is the default. JWT is the other session. It does not map email-code sign-in or external sign-in.

You needCallPage
Password sign-in for a browser, with a cookieAddPasswordAuth. Leave Session at Cookie.Quick start
A JWT sessionSession = Jwt, and a Jwt callback.Password auth, JWT
A native client that stores the refresh tokenJWT, and RefreshTokenTransport.Body.JWT
Identity bearer tokensAddBearerAuthEndpoints and MapBearerAuthEndpoints.Bearer auth
Passkeys beside passwordsSet Passkeys.ServerDomain on the password facade.Passkeys, Register users
Passkey login, and no public passkey registerMapSignInEndpoints with AddPasskeySignInEndpoints only.Passkeys
An emailed codeAddEmailCodeEndpoints. Sign-up and the magic link default to off.Sign in with an emailed code
GitHub or GoogleA provider package, then MapExternalAuthEndpoints.Register users
No public sign-upCompose sign-in, and do not map register or external sign-in.Run an app with no public sign-up
More than one session, or a custom mixThe Add* and Map* pair for each module.Composition table, Build a custom auth stack

Turn passkeys on

On the password facade, passkeys stay off until Passkeys.ServerDomain is a non-empty domain. That setting maps passkey sign-in and passkey management on the same prefix. Sign-in includes POST /passkeys/register, which creates an account. To map passkey login without that register route, follow Passkeys.

Add an emailed code

The password facade does not map email-code routes. Call AddEmailCodeEndpoints and map MapEmailCodeEndpoints on the prefix you choose. AllowSignUp defaults to false, so an unknown address does not become an account. MagicLink.Enabled defaults to false.

Add GitHub or Google

Install AuthEndpoints.OAuth.GitHub, AuthEndpoints.OAuth.Google, or both. Register the handler, then map MapExternalAuthEndpoints or MapExternalAuthProvider. The password facade does not map those routes.

A verified provider email creates an account when no local user has that email. There is no option to stop that. RequireVerifiedEmail defaults to true and refuses an unverified email. It does not stop creation for a verified email. See External OAuth.

Compose the pairs

Call the Add* method before the matching Map*. A missing Add* throws InvalidOperationException. The messages are in What you compose. The pairs, the routes, and the maps that contain each pair are in the composition table. Copy-paste hosts are in Build a custom auth stack.