Concepts
Realms
A realm is a separate population of people with its own sign-in: its own users, usernames, keys, clients, APIs, outside providers and policies. Nothing crosses between realms. A token one realm issued doesn't verify in another, a user id from one is unknown in the next, and a cookie from one means nothing to the other.
Each realm is its own OpenID Connect issuer at <public URL>/<realm>, for example https://auth.example.com/acme. Its discovery document is at <issuer>/.well-known/openid-configuration, and the same document is served where OAuth clients look for authorization server metadata (RFC 8414; MCP clients use it): /.well-known/oauth-authorization-server/acme, /acme/.well-known/oauth-authorization-server and /.well-known/openid-configuration/acme. Realm ids are DNS labels: 3–63 lower-case letters, digits and single hyphens.
Typical uses: one realm per product, one per customer of a multi-tenant product, or one per environment (acme-dev, acme).
Users
A user belongs to one realm. Users have:
- an id: a ULID, unique across realms and never reused;
- a username: case-insensitive and unique in the realm;
- a display name;
- optionally an email and the standard OpenID Connect profile claims: names, nickname, picture, website, gender, birthdate, time zone, locale.
They sign in with one or more of:
- passkeys (the default);
- a password, if the realm allows passwords, with an authenticator app as a second factor if set up;
- an outside provider they are linked to by (issuer, subject).
email_verified is never set by a user. Only an administrator, through the management API or the command line, can set it, and changing the address clears it.
Clients
A client is an app that signs people in, registered in a realm with a client id. Clients are:
- public (single-page apps, native and command-line apps, devices): no secret, so they must use PKCE;
- confidential (server-side web apps): a secret, shown once when registered and stored only as a hash;
- machine (services, no people): a secret, client credentials only, and they never sign anyone in.
Each user-facing client registers its redirect URIs, matched exactly, character for character. It can also register post-logout redirect URIs, the only places logout will send a browser back to.
APIs
An API (resource server) is registered in a realm with an identifier, an absolute URI that becomes the aud of its tokens, and the scopes it defines. Scopes can contain patterns: twilightdb:db:*:read defines read access to any database. Machine clients are granted scopes on an API: concrete ones (twilightdb:db:acme:read) or a pattern itself for an operator-level service. A token never carries more than its client was granted.
Every realm also has its own management API at <issuer>/api, registered automatically (Management API).
Connections
A connection is an outside OpenID Connect provider people can sign in with: Google, Microsoft Entra, Okta, another Nod. The sign-in page shows a button for each enabled connection. The first time someone signs in through a connection, they become a user of the realm, linked by the provider's issuer and their subject there. After that they are the same user each time.
Sessions and grants
- A browser session at Nod comes from signing in on Nod's page. It lasts 12 hours and lives in a random, HttpOnly cookie scoped to the realm. While it lasts, apps can sign the person in again without asking. Logging out ends it.
- A grant is created when an app exchanges a code for tokens. It ties a user, a client and a scope together. Access tokens name their grant, and refresh tokens rotate within it. Revoking the grant (logging out everywhere, or reusing a stolen refresh token) stops both.
Tokens
| Token | Format | Lifetime | For |
|---|---|---|---|
| ID token | JWT, typ: JWT, RS256 (or EdDSA if the client asks) | 1 hour | The app, to know who signed in. aud is the client id |
| Access token (user) | JWT, typ: at+jwt (RFC 9068), EdDSA | 15 minutes | Nod's userinfo. aud is the issuer |
| Access token (API) | JWT, typ: at+jwt, EdDSA, or RS256 for an API set to token_alg: RS256 (a verifier that takes no EdDSA) | The API's setting (15 minutes by default) | That API. aud is its identifier |
| Refresh token | Opaque, 256 bits | 30 days, rotated on every use | The token endpoint |
Each realm's signing keys are published at <issuer>/jwks. Keys can be rotated, and old keys keep verifying until they're removed.