Authentication
Users, sign-in methods and passwords in each realm.
Each realm with an auth section has its own pool of users and API keys, stored in the realm’s system database. One sign-in is meant to work across all databases of that realm (single sign-on), and never in another realm.
Strategies
A realm says how people sign in with named strategies in auth.strategies. A strategy is an ordered list of methods: the first proves who the person is, and a later one (totp) adds a step.
auth:
strategies:
password: [password] # email and password
password_totp: [password, totp] # and then an authenticator code
google: [google] # a provider declared in auth.providers
- The methods are
password,magic_link,totp(never first),sso(an organization’s own connection; needsorganizations.sso) and the names of the providers inauth.providers. - Choosing one. The sign-in routes take a
strategy(POST /_auth/login,POST /_auth/magic-link, the provider routes, and the same under/_auth/orgs/{org}/…). It may be left out while exactly one strategy starts with that method; otherwise the answer is400 strategy_required. A name that does not exist or starts with another method is400 unknown_strategy.GET /_auth/strategies(no credentials) lists the names and their methods, so an app can draw its sign-in screen. - Steps. Every method must succeed, in order. After the first, a
totpstep answers with a challenge (next: ["totp"]) thatPOST /_auth/mfa/verifytrades for the next step or the session; a person with no authenticator enrols as part of signing in (Multi-factor authentication). A person’s own authenticator never adds a step to a strategy that lackstotp. - Roles. A role can list the
strategiesit accepts (roles.<name>.strategies; none listed means all). A role is active in a session only if the session’s strategy is one of them:user.rolesin rules and functions, the admin API and the admin interface see the active roles only. A person who signs in with a strategy their role does not list still gets a session, without that role, and the answer’sroles_inactivesays which roles stayed off, so the app can offer a stronger way in. Listing is explicit: a stronger strategy does not carry a weaker one’s roles unless the role lists it. - The session records its
strategy, itsmethodsandmfa. auth: disabledruns a realm without authentication; a realm with neither is refused at startup. The keys that used to sit at the top ofrealm.yaml(signup,sessions,password,login_throttle,providers,sign_in,magic_link,reauth) now sit underauth:, andmfaisauth.totp; the old keys fail to start with a message that names the new place.
Sign-in methods: providers
A user holds only identity data: a unique email, whether that email is verified, roles, and whether the account is disabled. Credentials are not part of the user. Each way of signing in is a provider — a sign-in method (an identity) linked to the user:
password— built in, nothing to declare; the realm’s own accounts.magic_link— an emailed link or code, from the realm’sauth.magic_linksection (Magic links). It proves control of the mailbox, the same thing a password reset proves.google,microsoft,apple— remote providers, declared in the realm’sauth.providerssection with their credentials as realm secrets (Sign in with…).passwordandemailare reserved names: no provider may take them.
A user can have several methods at once, at most one of each kind — a password and Google, say. They all lead to the same user, so roles, rules and owned documents don’t depend on how the user signed in. A user can exist without a password (an operator may create the account first), and can remove any method but the last (DELETE /_auth/identities/{provider}); GET /_auth/me lists them. Application data about a user, such as a display name or avatar, belongs in your own collections, not in the user.
Whatever the first factor, a user with a second factor is still asked for it — a provider sign-in answers the same challenge a password does: Multi-factor authentication.
The pages, in order
| Page | What it covers |
|---|---|
| Authentication strategies | How a realm lets people sign in: strategies, their steps, and roles that depend on them |
| Users and passwords | Creating and managing a realm’s users with backd user or the admin API |
| Sign-up, login and sessions | The /_auth endpoints: sign up, log in, sessions, password reset, brute-force protection, sign-in methods, deleting the account |
| Magic links | Signing in from an email alone: the link, the code, account claiming |
| Passkeys | Signing in with a fingerprint, face, PIN or security key: how they work, rp_id and origins, native apps, a lost device |
| Re-authentication | A fresh proof of identity before sensitive actions |
| Multi-factor authentication | The TOTP second factor, recovery codes, roles that need it — applies to every first factor, remote providers included |
| Sign in with Google, Microsoft or Apple | The redirect flow, native ID tokens, linking rules, account.on_signup |
| Access rules | Per-collection rules: in collection.yaml: which callers may read, create, update and delete |
| Consents | Versioned texts, records, re-acceptance, withdrawal, gating |
| API keys | Server-side services, with full access to the realm’s data |
Operating it
- Command-line administration:
backd-server bootstrap,backd login,backd user. - Admin API: server-side user management.
- Audit trail of security-sensitive actions.
- Deactivating and erasing users, with per-collection policies for their data; compliance covers personal-data scope, retention and recipes.
- Provider sign-in in the clients: JavaScript and Dart —
signInWith,completeSignIn,signInWithIdToken.
See the security model for what backd protects, and the hardening checklist before exposing a realm. Planned: personal-data export as a downloadable package; other OpenID Connect providers (type: oidc).
How a realm decides who may sign in and with what: strategies in plain words, the common setups, and roles that depend on how a person signed in.
PasskeysSign in with a fingerprint, a face, a PIN or a security key instead of a password: how passkeys work in plain words, how to turn them on, and what to keep for the day a device is lost.
Users and passwordsCreate and manage a realm’s users with backd user or the admin API.
Sign-up, login and sessionsThe /_auth endpoints: sign up, log in, manage sessions, change or delete the account.
Magic linksSign in from an email: a link on the same device, or a code typed on any device. How it works, who can use it and what it protects against.
Re-authenticationA fresh proof of identity before sensitive actions: which proof applies to which user, the endpoints that ask for it and how a client sends it.
Multi-factor authenticationA second step after the first factor: how a sign-in answers with a challenge, how the second factor is checked, and how rules and functions see how a session was made.
Sign in with Google, Microsoft or AppleLet users sign in with an external identity provider: configuration, the redirect flow, linking rules, errors and security.
Access rules (rules:)Decide per collection which callers may read, create, update and delete documents.
ConsentsVersioned consent texts kept with the config, accepted and recorded as proof, and served to apps.
Personal data exportLet a user download everything the realm holds about them, and let support produce the same for a formal request.
API keysGive server-side services access to a realm’s data with API keys.