Client-Initiated Backchannel Authentication (CIBA)
Let a client ask a known user to approve access on their own device, with no redirect from the client.
OAuth2 OIDC
Client-Initiated Backchannel Authentication (CIBA) is an OpenID Connect flow for decoupled authentication: the client that wants tokens is not where the user signs in. The client names the user, your server sends that user a link, the user approves on their own phone or laptop, and the client then collects tokens. The client never redirects the user and never sees their credentials.
Use it when the client already knows who it is acting for but cannot show that person a browser:
- An AI agent or backend job that needs a person's approval before it acts for them.
- A call-center or support tool where the operator starts a sign-in the customer approves on their phone.
- A kiosk or terminal that should never collect the user's credentials.
If the client can show a code or a QR code to a person in front of it, use the device authorization grant instead.
The plugin extends @entro314labs/entro-auth-oauth-provider and requires oauthProvider() and jwt(). It supports the CIBA poll and ping delivery modes.
How the flow works
- The client calls
POST /oauth2/bc-authorizewith its credentials, the scopes it wants, and alogin_hintnaming the user. It receives anauth_req_idand a pollinginterval. - Your server reaches the user through your
sendNotificationcallback, by email or push notification, with a link to the provider. - The user opens the link, signs in if needed, and approves or denies on your consent page. They land on your
resultPage. - The client polls
POST /oauth2/tokenwith theauth_req_id. It receivesauthorization_pendinguntil the user decides, then the tokens oraccess_denied. A client registered for ping mode is also called back when the user decides, so it can wait for that instead of polling.
Installation
Install the plugin
npm install @entro314labs/entro-auth-cibaAdd the plugin to the server
Add ciba() after oauthProvider() and jwt(). sendNotification sends the user the link, and resultPage is the page they land on after deciding. Disable the JWT plugin's /token route and its set-auth-jwt header, as OAuth Provider Mode describes.
import { entroAuth } from "@entro314labs/entro-auth";
import { jwt } from "@entro314labs/entro-auth/plugins";
import { oauthProvider } from "@entro314labs/entro-auth-oauth-provider";
import { ciba } from "@entro314labs/entro-auth-ciba";
export const auth = entroAuth({
disabledPaths: ["/token"],
plugins: [
jwt({ disableSettingJwtHeader: true }),
oauthProvider({
loginPage: "/login",
consentPage: "/consent",
scopes: ["openid", "profile", "email"],
}),
ciba({
resultPage: "/ciba",
sendNotification: async ({ user, clientName, bindingMessage, url }) => {
if (!url) return; // absent only with approvalPage: false
await sendEmail({
to: user.email,
subject: `${clientName ?? "An application"} wants to act for you`,
text: `${bindingMessage ?? ""}\nReview the request: ${url}`,
});
},
}),
],
});Migrate the database
The plugin adds a cibaRequest model. Run npx @entro314labs/entro-auth-cli@latest migrate with the built-in Kysely adapter, or run npx @entro314labs/entro-auth-cli@latest generate and apply the schema with your ORM.
Show the binding message on your consent page
The link opens your existing consentPage. For a CIBA request, its query carries ciba_request_id, client_id, and scope. It also carries what the client sent of binding_message, acr_values, and authorization_details. Show the binding message as plain text next to the client and scopes, so the user can check that it matches what the client displays.
const params = new URLSearchParams(location.search);
const bindingMessage = params.get("binding_message"); // only for CIBA requests
// A JSON array, only when you configure authorizationDetailsTypes.
const authorizationDetails = params.get("authorization_details");The client chose the authorization details. Render them as text, never as HTML.
Accept or deny with oauth2.consent as you already do for authorization requests.
Build the result page
After the user decides, they land on resultPage with status=approved or status=denied. When the link is invalid, expired, already used, or for another account, they land there with error and error_description instead. Tell them they can return to the app that asked.
Register a client
A CIBA client is registered for the CIBA grant type and declares its backchannel_token_delivery_mode (CIBA §4), and in ping mode its backchannel_client_notification_endpoint. Dynamic registration and Client ID Metadata Documents accept both as top-level fields, and admin-created clients put them in metadata. Registration rejects a mode not in deliveryModes, and a ping endpoint that is not absolute https on a public host, with invalid_client_metadata. Registration checks the host name as written. The server checks the endpoint again, and resolves its host, before each ping. See Ping mode.
import { CIBA_GRANT_TYPE } from "@entro314labs/entro-auth-ciba";
const client = await auth.api.adminCreateOAuthClient({
headers, // an authenticated admin session
body: {
client_name: "Support Agent",
grant_types: [CIBA_GRANT_TYPE], // "urn:openid:params:grant-type:ciba"
metadata: { backchannel_token_delivery_mode: "poll" },
},
});
// Store client.client_id and client.client_secret for the agent.The client must authenticate at both /oauth2/bc-authorize and /oauth2/token (CIBA §7.1), so clients registered with token_endpoint_auth_method: "none" cannot use CIBA. An agent or CLI that cannot keep a client secret can authenticate with private_key_jwt instead.
By default, a private_key_jwt assertion must name the provider's issuer as its only aud value. This follows RFC 10070 §4 and deliberately departs from CIBA §7.1, which says an OpenID provider must also accept its token endpoint URL and its backchannel authentication endpoint URL as audiences. At /oauth2/bc-authorize, the assertionAudience option sets what the provider accepts:
assertionAudience | Accepted aud at /oauth2/bc-authorize |
|---|---|
"issuer" (default) | The issuer |
"issuer-or-endpoint" | The issuer or the /oauth2/bc-authorize URL |
The token endpoint URL is not an accepted audience at /oauth2/bc-authorize in either mode, so an assertion whose only aud is the token endpoint URL is rejected. Because "issuer-or-endpoint" needs just one accepted value, an aud list that also contains the issuer or the /oauth2/bc-authorize URL is accepted there, while "issuer" rejects any extra value. "issuer-or-endpoint" therefore does not make the provider accept every audience CIBA §7.1 lists. A client that signs for the token endpoint URL must sign for the issuer instead. See assertionAudience.
If anyone can register a client, any client can name any user. Set resolveUser to accept only identifiers the requesting client was already given, such as the sub from its earlier ID tokens, so a client cannot prompt or look up users it does not know:
ciba({
resultPage: "/ciba",
sendNotification,
resolveUser: async ({ loginHint, client }) => {
// Your lookup: map the subject this client received back to a user.
return findUserBySubjectForClient(loginHint, client.clientId);
},
});Request tokens from the client
The client starts a request, shows its binding_message to whoever is watching, then polls the token endpoint. Both calls are form-encoded and authenticate the client; this example uses HTTP Basic.
const basic = btoa(`${clientId}:${clientSecret}`);
const form = (body: Record<string, string>) => ({
method: "POST",
headers: {
authorization: `Basic ${basic}`,
"content-type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams(body),
});
// 1. Start the request.
const request = await fetch(
"https://auth.example.com/api/auth/oauth2/bc-authorize",
form({
scope: "openid profile",
login_hint: "ada@example.com",
binding_message: "Code 4821", // show this in the client too
}),
).then((r) => r.json());
// => { auth_req_id, expires_in, interval }
// 2. Poll until the user decides.
let interval = request.interval;
for (;;) {
await new Promise((resolve) => setTimeout(resolve, interval * 1000));
const body = await fetch(
"https://auth.example.com/api/auth/oauth2/token",
form({
grant_type: "urn:openid:params:grant-type:ciba",
auth_req_id: request.auth_req_id,
}),
).then((r) => r.json());
if (body.error === "authorization_pending") continue;
if (body.error === "slow_down") {
interval += 5; // CIBA §11: wait at least 5 more seconds from now on
continue;
}
if (body.error) throw new Error(body.error); // access_denied, expired_token, ...
return body; // { access_token, token_type, expires_in, id_token, ... }
}Ping mode
Enable ping with deliveryModes: ["poll", "ping"]. A ping client registers backchannel_token_delivery_mode: "ping" and the backchannel_client_notification_endpoint the server calls, and sends a client_notification_token with each backchannel request. When the user approves or denies, the server POSTs { "auth_req_id": "..." } to the endpoint registered when the request started with Authorization: Bearer <client_notification_token>, and the client then calls the token endpoint once. The server makes one attempt with a 5-second timeout and does not follow redirects. If the callback fails, the client can still poll.
Before each ping, the server checks the stored endpoint again and resolves its host name. A host name can pass the registration check and still resolve to a loopback, private, link-local, cloud metadata, or other address that is not publicly routable. If the lookup fails or any resolved address is not public, the server skips the ping and logs a warning. The decision is kept, and the client can still poll.
If a client runs on an internal network and its public-looking name resolves to a private address, add the origin of its backchannel_client_notification_endpoint to trustedOrigins. An origin in trustedOrigins skips only the lookup, and a loopback or private IP literal or a name such as localhost is still rejected. Only origins configured at initialization count, so an origin that a request resolves, such as from the Host header, does not.
The ping itself resolves the host name again and cannot be pinned to the address that was checked, so an answer that changes between the two lookups is still possible. On runtimes with no working DNS lookup, such as Cloudflare Workers, only the host name check applies. If you need a strict guarantee, restrict outbound network access from the server.
To get a JWT access token for an API, send its RFC 8707 resource with the request, as with other grants. A DPoP proof on the token poll binds the token to the client's key.
What the user sees
By default, the link points to /oauth2/authorize?ciba_request_id=<id>, so the request runs through the provider's own pages:
- A signed-out user goes to
loginPagefirst. Nothing about the request is shown before sign-in. postLoginruns as it does for an authorization request, and tokens carry thereferenceIdthatconsentReferenceIdreturns.consentPagealways opens, even for a client withskip_consentor a stored consent, because the user must confirm each request. The user can narrow the scopes there.- The decision is recorded only for the user the
login_hintnamed. Anyone else who opens the link, signed in as another account, lands onresultPagewith an error, and the request stays pending for the right user.
To approve only through your own page or app instead, see Approve only in your own app.
A denial is final: the client's next poll returns access_denied, and the link stops working. The ID token's auth_time is the creation time of the approving user's session, and its acr and amr are what the provider's authenticationContext.resolve returned for that session.
Approvals follow the consent
When the user accepts the consent page, the approval adds to their stored consent for the client, as it does for an authorization request. The approved request then follows that consent until the client redeems it:
- If the user deletes the consent, or narrows it below the approved scopes and resources, the client's poll fails with
invalid_grant. The request stays approved. - A consent given again for the same client, scopes, resources, and reference makes the request redeemable again until it expires. The link records one decision, so that consent comes from another request, such as an authorization request of the same client.
- Requests of a client with
skip_consentare not checked. - A request your app approves with
completeCibaRequeststores no consent, so it is not checked. This holds for every approval your app reports this way, including one from its own approval page.
Request a stronger sign-in
A client can ask for a stronger sign-in with acr_values, a space-separated list of ACR values in order of preference (CIBA §7.1). The request is voluntary. The provider accepts values it does not support, and the user can still approve with a weaker sign-in.
- When the user decides from the link, the provider passes the values to
authenticationContext.resolveasrequestedAcrValues. The ID token'sacris whatresolvereturns. sendNotificationreceives them asacrValues. When your own app collects the decision, authenticate the user as strongly as they ask when you can, and pass theacrthe user actually proved tocompleteCibaRequest.
The client reads the ID token's acr to learn what it got.
Approve structured actions
Some requests need more than scopes, such as a payment of a stated amount to a stated recipient. A client can describe these actions with authorization_details (RFC 9396), a JSON array of objects. Each object has a type, and you define the fields of each type.
To accept them, list each type in authorizationDetailsTypes with a validate function:
import * as z from "zod";
const payment = z.strictObject({
type: z.literal("payment_initiation"),
actions: z.array(z.literal("initiate")),
locations: z.array(z.url()),
instructedAmount: z.strictObject({ currency: z.string().length(3), amount: z.string() }),
creditorName: z.string().max(70),
});
ciba({
resultPage: "/ciba",
sendNotification,
authorizationDetailsTypes: {
payment_initiation: {
validate: (detail) => payment.safeParse(detail).success,
},
},
});Check every field in validate, and reject unknown fields and missing required ones. The client chooses every value, and the user approves what your pages show from it.
The provider then handles each request with authorization_details as follows:
-
It rejects the request with
invalid_authorization_detailswhen any of these is true:- The value is not a non-empty JSON array of objects.
- A
typeis not listed inauthorizationDetailsTypes. - A
typeis not among the types the client registered, when it registered any. validatereturnsfalse.
Without
authorizationDetailsTypes, every request withauthorization_detailsis rejected this way. -
It shows the details to the user, as
authorizationDetailsinsendNotificationand asauthorization_detailson the consent page. Approval from the link grants all of them. -
It returns the granted details as
authorization_detailsin the token response. A JWT access token carries them as a claim. For an opaque access token, introspection returns them.
Your API must check authorization_details before it acts. For example, it checks that the payment it is asked to make matches the approved amount and recipient.
The granted details belong to the provider. customAccessTokenClaims and a resource's customClaims cannot replace them or add any, in the token or at introspection.
A detail that lists locations is issued only in a token for one of those resources. When the poll narrows the token to other resources, that detail is left out of the response and the token (RFC 9396 §9.1). A detail without locations goes to every token.
A refreshed or exchanged token would not carry the details. So the provider issues no refresh token when the user approves authorization details, even with offline_access, and leaves offline_access out of the returned scope. Token exchange rejects an access token that carries authorization_details.
Discovery metadata lists the types as authorization_details_types_supported. Only /oauth2/bc-authorize accepts them. So /oauth2/authorize and /oauth2/par reject a request with authorization_details with invalid_authorization_details, instead of ignoring the details the client asked for.
To limit a client to some of the types, register it with authorization_details_types (RFC 9396 §10), such as ["payment_initiation"]. Registration fails with invalid_client_metadata when a type is not in authorizationDetailsTypes. A client without the field may request every listed type.
Issue delegated tokens
Some clients act for the user instead of being the user's own app, such as an AI agent that books a trip after the user approves. Its access token should say both who the user is and who acts for them. RFC 8693 §4.1 defines the act claim for this: sub is the user, and act names the actor. CIBA itself defines no actor, so the provider follows RFC 8693.
To issue delegated tokens, return the actor from resolveActor:
const agentClientIds = new Set(["travel-agent"]);
ciba({
resultPage: "/ciba",
sendNotification,
// Only these clients are agents that act for the user they name. Other
// clients get an ordinary token, with a refresh token.
resolveActor: ({ client }) =>
agentClientIds.has(client.clientId)
? { sub: client.clientId, sub_profile: "service" }
: undefined,
});resolveActor runs at /oauth2/bc-authorize, after the client authenticates and the login_hint resolves to a user. It receives { client, user, scopes } and the endpoint context. The provider stores the actor with the request, so it does not change between the request and the poll. Then:
sendNotificationreceives the actor asactor, and the consent page receives it as JSON in theactorquery parameter. Show it, so the user knows who will act for them.- The access token carries the actor as
act. A JWT access token has it in its payload. For an opaque access token, introspection returns it. The ID token is issued as usual: it names the user and has noact. - The token response has no refresh token, even with
offline_access, and the returnedscopeleaves outoffline_access. A refreshed token would not carryact.
Return undefined to issue a token without act. Throw an APIError to refuse the request: the client receives that error, and no request is created and no notification is sent.
The actor is your server's assertion, and resource servers trust it as they trust sub. Follow these rules:
- Return only an actor your server has verified. The authenticated
clientis verified. To name a different agent, verify its credential from the request, such as a signed assertion in a header thatctx.requestcarries, before you return it. Never copy an identifier the client sends without checking it. - Set
sub_profile: "service"on a client or agent actor. Without it, a pairwise client reads the actor'ssubas a user's pairwise subject.
The provider checks that the actor has the act shape: a non-empty string sub, an optional string sub_profile, and an optional nested act of the same shape. A malformed actor fails the request with server_error, and no request is created.
Decide from your own app
When your own app can reach the user, such as a mobile app that shows a push notification with Approve and Deny buttons, record the decision from your server with auth.api.completeCibaRequest instead of sending the user to the link. Set approvalPage: false so the provider's own link cannot approve the request, which would skip the checks your app runs (see Approve only in your own app). sendNotification receives the requestId to send to the app:
ciba({
approvalPage: false, // no link: only your server decides
sendNotification: async ({ requestId, user, clientId, clientName, scopes, bindingMessage, actor }) => {
// Always show who is asking; not every client has a name.
await push.send(user.id, { requestId, client: clientName ?? clientId, scopes, bindingMessage, actor });
},
});When the app reports the user's answer, your server states who decided and how they proved it:
await auth.api.completeCibaRequest({
body: {
requestId,
userId: appUser.id, // the user your app authenticated
decision: approved ? "approved" : "denied",
// Approval only. Each is optional.
scopes: ["openid", "profile"], // a subset of the requested scopes
authTime: new Date(), // issued as auth_time
acr: "urn:example:acr:biometric", // must be in acrValuesSupported
amr: ["face"],
authorizationDetails: approvedDetails, // what the user approved, if the request had any
},
});The provider records the decision only when userId is the user the login_hint named and the request is still pending. Otherwise, it returns invalid_request and changes nothing. Without acr, the ID token claims "0". State an acr when "0" is not in the provider's authenticationContext.acrValuesSupported. The approved scopes must be among the requested ones and include openid. A ping client is called back as it is after a decision from the link.
This call skips the provider's sign-in, post-login, and consent pages. It does not run postLogin.consentReferenceId. Tokens issued for a request you decide this way carry no referenceId. The call also stores no consent, and the poll does not check one. A request you approve this way can still be redeemed after the user deletes a consent for the client. Your app is responsible for:
- authenticating the user before it reports a decision,
- showing the client, the scopes, the binding message, and any actor before the user approves, and
- passing
scopeswithout any scope that needs a reference, such as an organization scope.
Without scopes, the approval covers every requested scope. Without authorizationDetails, it covers every requested detail. Pass [] to grant none. Each detail you pass must have a type the request carried and pass that type's validate. You can change a detail's fields, such as the account the user picked, so pass exactly what the user approved.
The ID token carries only the auth_time, acr, and amr you pass; without acr it reports "0".
| Error | Meaning |
|---|---|
invalid_request | The request is unknown, already decided, expired, or for another user, or acr is not in acrValuesSupported. |
invalid_scope | scopes includes a scope the client did not request, or leaves out openid. The request stays pending. |
invalid_authorization_details | A detail in authorizationDetails has a type the request did not carry, or fails validate. The request stays pending. |
Approve only in your own app
The provider's link still works while your app collects decisions. A user who opens it can approve through the provider's consent page and skip the checks your app runs, such as a step-up sign-in. To approve only through your own path, set approvalPage:
ciba({
approvalPage: "/approve",
sendNotification: async ({ user, url }) => {
if (!url) return; // absent only with approvalPage: false
await email.send(user.email, { link: url });
},
});approvalPage takes one of these values:
- A path or URL. The notification's
urlopens that page, with the request asciba_request_id, such as/approve?ciba_request_id=<id>. A path resolves against yourbaseURL. false. The notification has nourl. Use it when your own app shows the request, as in a push notification.
With either value, /oauth2/authorize no longer handles ciba_request_id. A request is approved only when your server calls completeCibaRequest, and it expires if your server never does. resultPage applies only to the provider's pages, so you do not set it.
Your approval page reads the request with auth.api.getCibaRequest, then records the decision with completeCibaRequest:
// Read the session from the session store, not the cookie cache.
const session = await auth.api.getSession({
headers,
query: { disableCookieCache: true },
});
if (!session) return redirectToSignIn();
const request = await auth.api.getCibaRequest({
body: { requestId: cibaRequestId, userId: session.user.id },
});
// Unknown, decided, expired, or for another user.
if (!request) return showExpired();
// Show request.clientName ?? request.clientId, scopes, resources,
// bindingMessage, actor, and authorizationDetails, then on the user's answer:
await auth.api.completeCibaRequest({
body: { requestId: request.requestId, userId: session.user.id, decision },
});getCibaRequest is server-only. It returns the same fields sendNotification receives, without user and url. It returns null when completeCibaRequest would refuse the request as unknown: the request is unknown, already decided, or expired, or userId is not the user the login_hint named. It also returns null when the client no longer exists.
Your page must still do everything completeCibaRequest leaves to your app:
- Authenticate the user before you read the request, and pass that user's ID as
userId. Never takeuserIdfrom the link. - Confirm the session in the session store, as the example does with
disableCookieCache: true. Withsession.cookieCache, a session you revoked can still be served from the cache, andcompleteCibaRequestdoes not use sessions, as Security explains. Without a server-side session store, the signed cookie is the session record, so leave the option out. - Show the client, the scopes, the binding message, and any actor or authorization details before the user decides.
- Treat
ciba_request_idas untrusted input.getCibaRequestreturnsnullfor an ID that is not the signed-in user's pending request.
Endpoints
POST /oauth2/bc-authorize
Starts a request. It accepts only application/x-www-form-urlencoded (CIBA §7.1), authenticates the client, and returns auth_req_id, expires_in, and interval. Each IP address can start 10 requests per minute. Discovery metadata advertises it as backchannel_authentication_endpoint, with backchannel_token_delivery_modes_supported set to deliveryModes and backchannel_user_code_parameter_supported set to false. With authorizationDetailsTypes, it also lists authorization_details_types_supported.
| Parameter | Required | Description |
|---|---|---|
scope | yes | Space-delimited scopes. Must include openid. |
login_hint | yes | Identifies the user, by email unless you set resolveUser. |
client_notification_token | ping only | An RFC 6750 bearer token of at most 1024 characters, sent back on the ping callback. |
binding_message | no | Up to 64 characters of plain text, in any script, shown in the notification, on the consent page, and by the client. |
requested_expiry | no | Requested lifetime in seconds, a positive integer. Capped at expiresIn. |
resource | no | One or more resource indicators the token is bound to. |
acr_values | no | Space-separated ACR values in order of preference, up to 1024 characters. See Request a stronger sign-in. |
authorization_details | no | A JSON array of RFC 9396 authorization details, up to 4096 characters once URL-encoded. See Approve structured actions. |
POST /oauth2/token
The provider's token endpoint. With grant_type=urn:openid:params:grant-type:ciba and the auth_req_id, it returns the tokens once the user approves, or one of the errors below. Each auth_req_id issues tokens once. The poll may send resource to narrow the token to some of the approved resources (RFC 8707 §2.2). For a request with authorization details, the response carries the granted authorization_details. For a request with an actor, the access token carries act and the response has no refresh token. The poll cannot narrow them: once the user approves, a poll that sends authorization_details is rejected with invalid_authorization_details.
Options
Prop
Type
Errors
The backchannel endpoint returns these CIBA §13 errors:
| Error | Meaning |
|---|---|
invalid_request | A required parameter is missing or malformed, the request uses a hint other than login_hint, or a ping client sent no valid client_notification_token. |
invalid_scope | scope does not include openid, the client may not request it, or a requested resource does not allow openid. |
invalid_client | The client did not authenticate, is unknown, or is registered as a public client. Returned with status 401 and a WWW-Authenticate challenge. |
unauthorized_client | The client is not registered for the CIBA grant with a delivery mode this server supports. |
invalid_binding_message | The binding message is longer than 64 characters or contains control or invisible formatting characters. |
unknown_user_id | No user matches the login_hint. |
invalid_target | A resource is malformed or unknown. |
invalid_authorization_details | authorization_details is malformed, has a type that is not in authorizationDetailsTypes, is not among the client's registered types, or fails its type's validate. |
server_error | resolveActor returned an actor without the act shape. |
The token poll returns:
| Error | Meaning |
|---|---|
authorization_pending | The user has not decided yet. Keep polling. |
slow_down | Polling faster than interval. Wait at least 5 more seconds between polls. |
access_denied | The user denied the request. |
expired_token | The request expired before the user decided. Once a later request has cleared it, the poll returns invalid_grant instead. |
invalid_grant | The auth_req_id is unknown, belongs to another client, or was already used. Also returned when the user deleted or narrowed the consent that a link approval stored, unless the client has skip_consent. The request then stays approved. |
invalid_target | The poll's resource was not approved for this request. The request stays approved. |
invalid_scope | The client no longer allows an approved scope, or a requested resource no longer allows openid. The request stays approved. |
invalid_authorization_details | The poll sent authorization_details. The request stays approved. |
server_error | The stored actor no longer has the act shape. The request stays approved. |
Schema
The plugin adds one model, cibaRequest:
| Field | Type | Description |
|---|---|---|
authReqId | string | The auth_req_id, hashed like the provider's tokens. The raw value is never stored. |
clientId | string | The client that started the request. |
userId | string | The user the login_hint named, the only user who can decide. |
scope | string | The requested scopes, narrowed to the approved ones on approval. |
bindingMessage | string | The optional binding message. |
acrValues | string[] | The optional requested ACR values, in order of preference. |
authorizationDetails | string | The optional RFC 9396 authorization details as JSON text, narrowed to the granted ones on approval. |
resources | string[] | The optional resource indicators. |
actor | json | The optional actor resolveActor returned, issued as the access token's act claim. |
status | string | pending, approved, or denied. A request is deleted when tokens are issued, when the client learns of a denial or expiry, or when a later request finds it expired. |
clientNotificationEndpoint | string | Ping mode only: the client's notification endpoint when the request started. |
encryptedClientNotificationToken | string | Ping mode only: the client's client_notification_token, encrypted with the server secret. |
encryptedAuthReqId | string | Ping mode only: the auth_req_id, encrypted with the server secret, because the callback carries the raw value. |
referenceId | string | The consent reference recorded on approval, such as an organization. |
approvedViaConsent | boolean | Set when the user approved from the link, which stored a consent. Redeeming such a request checks that consent. Unset for completeCibaRequest. |
authTime | date | Creation time of the approving session, or the authTime passed to completeCibaRequest, issued as auth_time. |
acr | string | The acr the approval established, issued in the ID token. |
amr | string[] | The amr the approval established, issued in the ID token. |
lastPolledAt | date | When the client last polled. |
expiresAt | date | When the request expires. |
createdAt | date | When the request was created. |
Security
- Only the named user can decide. Approval from the link always shows consent, so a user who receives a request they did not expect can deny it, and someone else who gets hold of the link cannot approve or deny it.
completeCibaRequestalso refuses a decision for any other user, but it skips consent: it trusts your server to have authenticated that user and shown them the request. - Limit who a client can name. Each request notifies a person, and
unknown_user_idtells the client whether a hint matched a user, as CIBA §13 specifies. Each IP address can start 10 requests per minute. When anyone can register a client, resolvelogin_hintonly to users the client already knows, as shown in Register a client. - The binding message ties the two devices together. Ask clients to send a short, random
binding_messageand to display it, so the user can tell their request apart from one someone else started at the same moment. Render it as text. - Authorization details come from the client. The provider checks only their shape and type, and leaves each field to your
validate. Validate strictly, render them as text, and have your API enforce the granted details itself. - The actor is your assertion. Resource servers trust
actas they trustsub. Return an actor fromresolveActoronly after your server has verified it, and show it to the user before they approve. - The ping callback only reaches safe endpoints. Registration and each request check that the notification endpoint is absolute
httpson a public host, with no credentials or fragment, the same rules asbackchannel_logout_uri. Before each ping, the server also checks the stored endpoint again and resolves its host, and skips the ping if any address is not public. See Ping mode for what this does not cover, and restrict outbound network access where you can. - Tokens are issued once. An approved request is claimed and deleted in one atomic step, so of two concurrent polls only one receives tokens. The claim comes after
beforeTokenIssuance, so a refusal there keeps the request approved. Concurrent polls can each reach that hook before one wins the claim, so a hook with side effects can run more than once for one approval. Theauth_req_idis stored hashed. - Only an active session can decide. The provider's own pages confirm the approving session in the session store before they record an approval, and before they record a denial from the consent page. With
session.cookieCache, a session you revoked can still be served from the cache until it expires. That session cannot approve or deny a request, and the user is sent to the result page with an error. The request stays pending, and the user can decide again after signing in.completeCibaRequestdoes not use sessions, so your server owns that check.
Current limitations
- Push delivery is not supported.
- Only
login_hintis supported;id_token_hintandlogin_hint_tokenare rejected withinvalid_request. user_codeand signed authentication requests are not supported.- Refresh tokens do not store authorization details or an actor, so a request with either gets no refresh token. An access token with authorization details cannot be exchanged.
- Only
/oauth2/bc-authorizeaccepts authorization details. - There is no API that lists a user's pending requests. To show them in your app, keep the
requestIds thatsendNotificationreceives. - There is no per-user limit on requests; the limit applies per IP address.