allow: [role.signedIn], a class grant, and nothing more: it creates no other role, membership or family member. Roles, labels and guards
decide what the authenticated caller may read, change and release.
Choose a provider
Two equal paths, with the same native sessions, roles, grants, labels and invitations after sign-in:- Bijection Auth for a quick start: passkeys, email codes and magic links, GitHub, Google and Apple, served by your installation with no vendor to set up. It deliberately stays small.
- Your own provider (WorkOS AuthKit, Clerk, Auth0 or any OpenID Connect issuer) when you need what an identity provider offers: enterprise SSO, organizations, MFA policies, user administration, or the accounts you already have.
Use the typed client to attach the token from your
chosen provider.
For Bijection-managed sign-in, declare a
sessionExchange operation for the
provider’s exact HTTPS token endpoint. Bijection Auth declares its own
endpoint. Native sessions use the matching declaration to retain a production
exchange across retries.
Changing providers? See Switch identity providers.
Native session renewal
Native sign-in renews retained sessions with the provider’s refresh token by default. A provider entry inbijection/sign-in.ts can instead set
nativeSessions: { renewal: "native" } alongside its cli or browser
registration. Bijection then renews using the identity verified at sign-in.
Both modes enforce the session’s idle and absolute lifetimes, revocation and
current source configuration, and both rotate the session’s refresh
credential (see Session security).
In native renewal mode, configure the provider’s supported lifecycle events
to propagate provider-side account or session changes before the next
sign-in. For example, enable OIDC back-channel logout
for an OIDC source. Sessions that require fresh provider evidence use provider
renewal.
Session security
Native sessions keep these guarantees on every deployment:- Refresh credentials rotate. Each refresh answers a new refresh
credential and retires the one you presented. Store the new one. If a
refresh reply is lost, retry with the same
requestIdand the same credential to recover the answer. Presenting a retired credential under another request ends the whole session, and the reuse is recorded in the session audit. The CLI and the Bijection Auth browser integration already persist the request ID before sending. - Provider logouts end the right sessions. A back-channel logout, CAEP
or WorkOS event that names only a provider session (
sid) ends every session that signed in under that provider session, through any client of the same issuer. An event that names only the person, with nosid, ends the person’s sessions from that source. It also refuses later sign-ins through that source’s client that reuse an authentication from before the event, so the person must authenticate again at the provider to sign in there. Sign-ins through the issuer’s other clients, which the provider did not log out, are not affected. - Disabled identities stay out. A provider event that disables an
identity (WorkOS
user.deleted), or the session control’sdisableaction, ends the person’s sessions and refuses every later sign-in until the session control’senableaction re-enables the identity. - Operators control a person’s sessions.
bijection admin sessions control --action endAllends every session of a person. WithrequireReauthenticationit also refuses every later sign-in, through any client, unless the person authenticates again at the provider, so single sign-on that reuses the old authentication signs in to nothing.revokeProviderSession --issuer <url> --session <sid>takes no--principal: it ends every session under that provider session, whoever signed in and through whichever client of the issuer, and refuses every later sign-in under it, even if no one has signed in under it yet. The provider’s own session stays open, so sign the person out there too. A CAEP event declared asrequireReauthenticationends the person’s sessions through the event’s client, and refuses sign-ins through that client that reuse an authentication from before the event. Sessions through the issuer’s other clients stay signed in. If the event names only a provider session, it revokes that provider session the wayrevokeProviderSessiondoes. - Source changes end old sessions. When a deploy or an environment change alters or removes a sign-in source (for example to enforce SSO), sessions that signed in through the old source stop working at once, and their sessions end. Sign in again through the current source.
- Short login state. The
attemptIdand the provider redirect’sstateare a short random handle, so providers withstatelength limits work. The attempt itself stays sealed on the deployment until it expires.
End a native session
POST /api/bijection/identity/session/end accepts the caller’s own native
access token and DPoP proof. Send { requestId, allSessions, providerRevocation }
as JSON. Use a random request ID, set allSessions to select the verified
identity’s live native session grants, and use providerRevocation: "none" to sign out of
the application. The CLI and the Bijection Auth browser integration use this
endpoint.
To recover the same receipt, retry with the same request ID and options, the
original session and a fresh proof. You can recover a committed receipt for
seven days even after the access token expires. The native receipt reports
its targetScope. With current_grants, the native decision ends the selected
live grants. With accepted_grants, the provider Task fixed the exact set at
acceptance. Recovery closes any of those grants that still stand, even if a
provider event already ended the acting session. Sessions opened later and
successor grants issued by renewal remain active.
providerRevocation: "request" returns a separate
provider result for the provider refresh grant held by the session:
no_provider_grantwhen the session holds no provider refresh grant, for example withnativeSessions: { renewal: "native" }or Bijection Auth.unsupportedwhen the provider’s discovery document advertises norevocation_endpoint.- Otherwise, Bijection orders one provider revocation. A
ProviderRevocationPendingresponse means the Task exists. Retry with the same request ID, scope and original session proof, omitting the refresh credential and settingreceiptOnly: true. The provider result settles asconfirmed,refusedorunknown. The local settlement is bounded by the original session grant’s cutoff.
Trust verified email for invitations
To accept invitations addressed to an email, opt intotrustVerifiedEmail: true
on each provider whose email verification you trust. Add it to the provider
entry in bijection/sign-in.ts alongside the issuer and client settings.
The setting defaults to false for every provider. bijection auth init
sets it on the built-in source. For an external source configured through
auth init, opt in with --trust-verified-email.
bijection/sign-in.ts
bijection/app.ts. After deploying, trust
the provider’s values for it:
attest for that issuer and
its values. Only the installation’s identity admin issues it, never code: no
deploy and no bijection env set changes it. Each identity that signs in
through the issuer is bound to its principal by a grant under that trust,
which carries speak for the principal, and each session is a grant under
the binding. Revoking the trust ends every binding and session under it.
Disabling an identity revokes its binding; enabling it again issues a new
one.
For a direct user login, ctx.frame.as.email holds the email when the source
is opted in and its verified token asserts email_verified: true. Otherwise
it is null. Configure the provider
to include both claims in the token your installation verifies. This evidence
matches membership invitations. The
principal and application grants still decide access. A caller whose provider
supplies no trusted email can accept an invitation without an email
restriction using its token.
A provider that verifies phone numbers can also put phone_number and
phone_number_verified in the token. The host gives functions and guards the
verified number in as.phone, or null. An SMS consent guard can require
that number.
Use the identity in your application
Read the verified principal withctx.frame.as inside a
function. Its id is a kind-qualified
PrincipalId (person:…): a random ID the host assigns to each sign-in
identity (one issuer and subject) and keeps across sign-ins, renewals and
devices. Functions never see the provider’s subject, so key users by this
principal. Every provider works the same way, Bijection Auth included: it
binds the principal to its own user once per sign-in through a
sender-bound claim.
If the application needs a user record,
store it in an ordinary table. Live
grants, labels and guards determine what that person may do.
The management-console account controls projects and deployments. It is
independent of application users and never supplies an application JWT. Staff
using business tools through the CLI or workspace should follow
Workforce users.