Sign-in and accounts

The sign-in methods your users get, how two-factor and passkeys work, what the account page offers, and the settings that switch each method on.

Updated · 3 min read

Your users sign up with an email and password, then sign in by password, emailed link, passkey, Google or GitHub. They can add two-factor, keep several accounts signed in on one browser, and manage everything from the account page. Better Auth handles all of it; the starter never writes its own password or cookie code.

Sign-in methods

The sign-in page shows only the methods this deployment has switched on.

MethodNeedsNotes
Email and passwordNothingPasswords need at least 12 characters. The sign-up form shows how many are still needed.
Emailed linkLOOPS_API_KEY and LOOPS_MAGIC_LINK_TEMPLATE_IDThe link works once, for 5 minutes, and creates the account if there isn't one.
PasskeyNothingBound to the host in APP_ORIGIN. Browsers that support it offer saved passkeys in the email field.
GoogleGOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRETRegister the callback URL with Google.
GitHubGITHUB_CLIENT_ID and GITHUB_CLIENT_SECRETRegister the callback URL with GitHub.

The callback URL for Google and GitHub is https://<your domain>/api/auth/callback/<provider>, where the provider is google or github. A provider appears only when both its id and secret are set.

The page marks the method each person used last with a "Last used" badge. Signing in with Google or GitHub whose verified email matches an existing, verified account links to that account rather than creating a second one.

Two-factor and passkeys

A user turns on two-factor from Account → Security with their password. They scan a QR code in an authenticator app, confirm a code and save ten backup codes. From then on, signing in with email and password asks for a six-digit code. "Trust this browser for 30 days" is on by default. Ten failed codes lock the second factor for 15 minutes.

Two-factor applies to email and password sign-in only. Emailed links, passkeys and social sign-in don't ask for it, and an account with no password can't turn it on. APP_NAME is the name authenticator apps and passkey prompts show (default "React SaaS Starter").

Changing your domain orphans the passkeys people added on the old one. Settle on your domain before you launch.

The account page

Account (/account) has three tabs:

  • Profile: name, email (verify or change it) and account deletion.
  • Security: password, or "email me a link to set one" for accounts without one; two-factor; passkeys (add, rename, remove); connected Google and GitHub accounts.
  • Sessions: the accounts signed in on this browser (switch, sign out, add another, up to five) and the devices signed in to this account (revoke one or all others).

Account deletion is refused while the user is the only owner of any organisation, so no organisation is left without an owner.

Sign-up, onboarding and the dashboard

Sign-up asks for a name, work email and password, then sends the user to onboarding: a few words about them, a workspace (accept a pending invitation, continue in an existing organisation or create one), invite up to five teammates, done. Each step has its own address, so refreshing or going back keeps the place.

The dashboard then shows a getting-started checklist (verify email, workspace, invite, secure the account, and a plan when billing is on), which the user can hide, and cards for their team, plan and security.

Verification and password reset

Sign-in doesn't need a verified email. With the verification template configured, sign-up sends a verification email, and following the link verifies and signs in. A failed email never fails sign-up. Accepting an organisation invitation does need a verified email.

Password reset starts at /forgot-password and needs the reset template. Both emails, and their templates, are covered in Email.

Security defaults

  • Breach check. In production, a new password that appears in a known breach is refused. Only the first five characters of its hash leave the server. Set PWNED_PASSWORD_CHECK=off to skip it, or on to use it outside production.
  • Rate limits on the auth endpoints, stored in the database.
  • Secure cookies in production. Sessions aren't cached in a cookie, so a role change applies on the next request.

To require a verified email before anyone can sign in, the setting is Better Auth's requireEmailVerification. Configure the Loops verification template first, or nobody can sign in.

Something unclear or missing? Ask us and we'll answer, then fix the page.