Skip to Content

OAuth Provider reference

OAuth provider options, endpoints, errors, rate limits, extensions, and database schema.

Plugin options

Pass these options to oauthProvider(). Only loginPage and consentPage are required.

Sign-in flow

loginPage string

Required. Page the authorize endpoint redirects to when the user must sign in. See Login page.

consentPage string

Required. Page the authorize endpoint redirects to when the user must consent. See Consent page.

signup object

Settings for prompt=create. See Sign-up account screen.

selectAccount object

Settings for prompt=select_account. See Select account screen.

postLogin object

A step between login and consent, such as choosing an organization. See Post-login screen.

allowPublicClientPrelogin boolean

Lets /oauth2/public-client-prelogin answer before sign-in when the request carries a valid signed oauth_query. The requested client_id must match the client in the signed query. Defaults to false.

Scopes and claims

scopes string[]

Scopes clients may request. Without openid, the provider is OAuth only. Defaults to ["openid", "profile", "email", "offline_access"]. See Scopes.

requireOpenId boolean

Requires authorization code requests to include the openid scope. Once the client and redirect_uri have been validated, a request without openid, or with no scope at all, is redirected to the client's redirect_uri with invalid_scope. Pushed authorization requests at /oauth2/par and calls to issueAuthorizationCode return invalid_scope directly. Device authorization and CIBA approvals are unaffected. Defaults to false, where a request without openid is served as plain OAuth and a request with no scope falls back to the client's registered scopes, or to the provider's scopes when the client has none. openid must be in scopes, or the plugin fails at startup.

advertisedMetadata { scopes_supported?, claims_supported?, token_endpoint_auth_methods_supported? }

Overrides what the two discovery documents advertise, and can add values as well as hide them. Every scopes_supported value must be in scopes. token_endpoint_auth_methods_supported lists exactly the methods you set in both discovery documents, and every method must be one the server supports (none, the built-in confidential methods, or a method contributed through extensions or a companion plugin's extendOAuthProvider call). The list cannot be empty or repeat a method, or the plugin fails at startup. An unsupported method throws when discovery metadata is built, because companion plugins register their methods after the provider is created. Unset, none is listed when allowUnauthenticatedClientRegistration is true or an extension contributes client discovery, such as the CIMD plugin. These options change only what discovery advertises. They do not change which clients the token endpoint accepts, and they do not open /oauth2/register. See Discovery metadata.

customAccessTokenClaims (info) => Awaitable<Record<string, any>>

Adds access token claims, also returned by introspection. See Custom claims.

customIdTokenClaims (info) => Awaitable<Record<string, any>>

Adds ID token claims. Reserved names are stripped. See ID token claims.

customUserInfoClaims (info) => Awaitable<Record<string, any>>

Adds UserInfo claims. See UserInfo.

authenticationContext { acrValuesSupported, resolve }

Asserts the acr and amr ID token claims for each authorization request or interaction request, such as a device code or a CIBA (Client-Initiated Backchannel Authentication) request, that the user approves on the provider's pages. acrValuesSupported lists the acr values the provider may issue, advertised as acr_values_supported. It must not be empty or contain an empty string, or the plugin fails at startup. resolve returns the acr and amr the current session established. It is not called for requests without the openid scope. Without this option, ID tokens from an approval on the provider's pages carry acr: "0" and no amr. An ID token from completeCibaRequest, or from issueTokens in a grant extension, carries the acr and amr you pass. Without an acr, it carries "0". See Authentication context.

beforeTokenIssuance (input: OAuthBeforeTokenIssuanceInput) => Awaitable<void>

Runs once for each token issuance, for every grant, after the grant is validated and before any token is stored. A refresh retry that matches the original client, scopes, resources, and DPoP key within refreshTokenReuseInterval returns the earlier response without calling it. A differing retry gets invalid_grant. Throw an APIError with an OAuth error, usually invalid_grant, to refuse the issuance. See Refuse token issuance.

customTokenResponseFields (info) => Awaitable<Record<string, unknown>>

Adds fields to the token response body. Standard fields cannot be overridden. Runs after beforeTokenIssuance. See Custom token response fields.

pairwiseSecret string

Enables pairwise sub values for clients with subject_type: "pairwise". Must be at least 32 characters. See Pairwise subject identifiers.

accessTokenSubject "user" | "pairwise"

The sub of JWT access tokens issued to a user. It has no effect on opaque access tokens, which the provider issues when the client requests no resource or the JWT plugin is disabled. "user" uses the user ID for every client. "pairwise" uses a pairwise client's ID token sub and names users in act and may_act the same way. So the provider can still find the users, the token carries a ba_sub claim that encrypts the user ID and its real act and may_act. "pairwise" requires pairwiseSecret, or the plugin fails at startup. Defaults to "user". See Pairwise sub in JWT access tokens.

Clients and registration

grantTypes GrantType[]

Grants the token endpoint accepts. refresh_token requires authorization_code. Extension grants are added on top. Defaults to ["authorization_code", "client_credentials", "refresh_token"].

validateRedirectUri (uri, registeredUris, defaultResult) => Awaitable<boolean>

Replaces exact redirect URI matching. See Custom redirect URI validation.

allowInsecureRedirectUri (url: URL) => boolean

Accepts http redirect and post-logout redirect URIs that the default policy rejects. See HTTP redirect URIs.

cachedTrustedClients Set<string>

Client IDs to cache. Cached clients cannot be changed through the CRUD endpoints. See Trusted clients.

clientPrivileges (context) => Awaitable<boolean | undefined>

Authorizes client actions: create, read, update, delete, list, rotate, and configure-client-credentials-scopes. See Client CRUD privileges.

clientReference (context) => Awaitable<string | undefined>

Returns the owner reference, such as an organization ID, for new clients. See Organizations.

allowDynamicClientRegistration boolean

Enables POST /oauth2/register. Defaults to false. See Dynamic client registration.

allowUnauthenticatedClientRegistration boolean

Accepts registration requests without a session. Defaults to false. Anyone on the internet can then register a client; read Dynamic client registration before you enable it.

validateInitialAccessToken (context) => Awaitable<{ referenceId?, clientCredentialsScopes? } | false>

Enables registration with an initial access token (RFC 7591 §3). referenceId sets the client's owner. clientCredentialsScopes sets the client's scope ceiling for client_credentials and defaults to []. See Dynamic client registration.

clientRegistrationDefaultScopes string[]

Scopes stored on every dynamically registered client. Defaults to scopes, so registered clients get every scope your server defines. Narrow it when you enable open registration. With requireOpenId: true, an authorization request that omits scope fails with invalid_scope. Otherwise, the request gets only the client's scopes that are also in this list. When you leave the option unset, such a request gets every scope the client may request. See Requests that omit scope.

clientRegistrationAllowedScopes string[]

Extra scopes a registration may ask for. Every value must be in scopes. Defaults to [].

clientRegistrationRequirePKCE boolean

Whether dynamically registered confidential clients require PKCE. Defaults to true. false removes the protection against intercepted and injected codes for every such client, including anonymous ones. See PKCE.

clientRegistrationEnableEndSession boolean | (input) => boolean | Promise<boolean>

Whether clients created through dynamic registration, a Client ID Metadata Document, or createOAuthClient may use RP-initiated logout. The function form receives { client, registrationSource }. Defaults to false. When such a client is registered, when its owner adds an entry with updateOAuthClient, and when adminUpdateOAuthClient grants logout to a client the caller does not own, each post_logout_redirect_uris entry must share a scheme, host, and port with one of its redirect_uris, or with the client_id URL of a metadata document client. Loopback hosts match on any port, and private-use URIs match on scheme and authority. The CIMD plugin also binds a metadata document's entries to the origin of its client_id URL, unless you change originBoundFields, so a metadata document client cannot use a web origin that only its redirect_uris have. HTTP(S) loopback redirects and hostless reverse-domain private-use logout URIs such as com.example.app:/logout are exempt from the CIMD origin check. See Registered clients.

clientRegistrationDefaultApplicationType "web" | "native" | "infer"

application_type used when a registration omits it. Defaults to "web".

clientRegistrationClientSecretExpiration number | string | Date

The client_secret_expires_at value returned to dynamically registered clients that receive a secret. A string such as "30d" is a duration from registration. A number (Unix seconds) or a Date is a fixed time. After that time, the secret is rejected with invalid_client. Defaults to no expiry.

clientRegistrationDefaultResources string[]

Resources linked to every new client, including CIMD, anonymously registered, and admin-created clients. Each must be in resources. Every client that can register can then get tokens for these APIs.

clientRegistrationAllowedResources string[]

Resources a registration may request. Each must be in resources. When both resource options are omitted, requested resources are rejected.

assertionMaxLifetime number

Maximum lifetime in seconds of a private_key_jwt assertion. Defaults to 300. See Private key JWT.

assertionAudience "issuer" | "issuer-or-endpoint"

The aud values accepted in client assertions, such as private_key_jwt assertions, at every endpoint that authenticates a client except POST /oauth2/client/rotate-keys. Defaults to "issuer".

  • "issuer": the assertion's aud must be the provider's issuer and nothing else, as RFC 10070 §4 and §5 require. An aud list that also names another value is rejected.
  • "issuer-or-endpoint": the behavior before 1.8. The assertion's aud must include the URL of the endpoint called, the issuer, or, at /oauth2/par, the token endpoint URL.

At /oauth2/bc-authorize, which the CIBA plugin serves, "issuer" accepts the issuer, and "issuer-or-endpoint" accepts the issuer or the /oauth2/bc-authorize URL. Neither accepts the token endpoint URL there. The "issuer" default follows RFC 10070 and deliberately departs from CIBA Core §7.1, which says a provider must also accept its token endpoint URL and its backchannel authentication endpoint URL as audiences.

"issuer-or-endpoint" is a transitional setting for clients that still sign for an endpoint URL. It is weaker: a client that signs for an endpoint URL can be tricked into signing an assertion that a malicious server replays here. Move your clients to the issuer, then remove the setting.

POST /oauth2/client/rotate-keys is the exception. In either mode, the assertion's aud must include that endpoint's own URL, and may also name other values.

assertionClockTolerance number

Seconds of clock skew accepted on the nbf, exp, and iat of a private_key_jwt assertion. Defaults to 0, which accepts no skew. Values above 60 are treated as 60, and negative or non-finite values are treated as 0. See Private key JWT.

allowClientKeyRotation boolean

Enables POST /oauth2/client/rotate-keys. Startup fails on the memory adapter or with advanced.database.generateId: "serial", which cannot keep assertions single-use. Defaults to false. See Rotating client keys.

Resources

resources Array<string | OAuthResourceInput>

Protected resources seeded into oauthResource at startup. See Resources.

resourceSeedMode "insertOnly" | "merge" | "overwrite"

How seeding treats existing rows: skip them, update only the configured fields, or replace them. Defaults to "insertOnly".

resourceSeedScope "adapter" | "process"

How long a finished seed is remembered. "adapter" (default) remembers it per database adapter. "process" remembers each seeded entry for the life of the process, for apps that build Entro Auth per request, such as on Cloudflare Workers. Use "process" only when every instance in the process uses the same database.

resourceDefaults { accessTokenFormat? }

Access token format for every resource that does not set its own. accessTokenFormat is "jwt" or "opaque" and defaults to "jwt". A JWT is issued only when the request names a resource and the JWT plugin is enabled. See Access token format.

enforcePerClientResources boolean

Requires a client to be linked to every resource it requests (RFC 8707 §2). Defaults to true. false lets any client, including self-registered ones, get tokens for every enabled resource.

cachedResources Set<string>

Resource identifiers to cache. Writes through the admin endpoints invalidate the cache.

identifierValidator (identifier) => Awaitable<boolean>

Validates identifiers created through the admin endpoints or registration. The default requires an absolute URI without a fragment (RFC 8707 §2).

resourcePrivileges (context) => Awaitable<boolean | undefined>

Authorizes resource actions: create, read, update, delete, list, link, and unlink.

Without resourcePrivileges, any signed-in user whose headers reach the admin resource endpoints can manage resources. Define it before calling those endpoints from a route.

Tokens

accessTokenExpiresIn number | ({ user, client, scopes, grantType }) => Awaitable<number>

Access token lifetime in seconds. Defaults to 3600. A function decides it for each grant. See Lifetimes and Per-grant access token lifetime.

accessTokenMaxExpiresIn number

The longest lifetime in seconds that an accessTokenExpiresIn function may return. A longer result is lowered to it. The grant revocation entry lasts this long plus one second, and the record of a redeemed code lasts the longer of this and refreshTokenExpiresIn. Defaults to 3600. Ignored when accessTokenExpiresIn is a number. It must be a positive whole number of at most ten years in seconds.

m2mAccessTokenExpiresIn number

Lifetime in seconds of client_credentials access tokens. Defaults to 3600.

idTokenExpiresIn number

ID token lifetime in seconds. Defaults to 36000.

refreshTokenExpiresIn number

Refresh token lifetime in seconds. Defaults to 2592000. Each refresh starts a new window, so a regularly used grant does not expire.

codeExpiresIn number

Authorization code lifetime in seconds. Defaults to 600.

scopeExpirations Record<scope, number | string | Date>

Shorter access token lifetimes per scope. The earliest expiry wins.

refreshTokenReuseInterval number

Seconds a rotated refresh token can replay the same response. Defaults to 0. See Refresh tokens.

formatRefreshToken { encrypt, decrypt }

Custom refresh token encoding sent to clients.

disableJwtPlugin boolean

Issues opaque access tokens and HS256 ID tokens. Defaults to false. See Without the JWT plugin.

revocableJwtAccessTokens boolean

Lets /oauth2/revoke revoke JWT access tokens by jti, and makes revoking a refresh token also revoke the JWT access tokens of its grant. The same happens when a rotated refresh token or an authorization code is replayed. Introspection, UserInfo, and validateAccessToken then look up each JWT access token in the verification store. Defaults to false. See Revoke JWT access tokens.

revokeGrantsOnPasswordReset boolean

Revokes the access and refresh tokens stored for a user when their password is reset, including offline_access grants that no session holds. It applies when emailAndPassword.revokeSessionsOnPasswordReset is on. JWT access tokens are revoked only with revocableJwtAccessTokens, and only when their grant has a stored refresh token or opaque access token. Defaults to true. Set it to false to keep a user's tokens across a password reset. The reset still ends the user's sessions, and so a JWT access token that carries their sid. See Password reset.

onTokenRevoked (event) => void | Promise<void>

Called after the provider revokes a grant or a single access token: when a client revokes a token at /oauth2/revoke, and when a client presents a used authorization code or refresh token again. The event has type, reason, clientId, expiresAt, and ctx, and jti, grantId, or userId depending on the token. It isn't called when a session ends, a client is disabled or deleted, a resource or consent is deleted, or a password reset revokes stored grants. Delivery is best effort: the response waits for the callback, and an error it throws is logged and does not change the response. See Observe revocations.

dpop { proofMaxAgeSeconds?, signingAlgorithms?, nonce? }

DPoP proof validation. proofMaxAgeSeconds defaults to 300, and signingAlgorithms to ["EdDSA", "ES256", "ES512", "PS256", "RS256"]. See DPoP.

nonce takes { required, expiresIn? }. With required: true, DPoP proofs at the token and UserInfo endpoints, and at plugin endpoints that call verifyDpopProof, must carry a nonce the server issued. expiresIn is in seconds and defaults to 300. See Server-provided nonces.

pushedAuthorizationRequests { enabled, required?, expiresIn? }

Pushed authorization requests (RFC 9126). enabled: true serves /oauth2/par and advertises pushed_authorization_request_endpoint, when grantTypes includes authorization_code. required: true rejects authorization requests without a request_uri with invalid_request, and advertises require_pushed_authorization_requests: true. It needs enabled: true, or the plugin fails at startup. expiresIn is how many seconds the client has to send the user to the authorize endpoint with the request_uri. It defaults to 60 and must be a positive whole number below 600. After the first visit, the request_uri stays valid for codeExpiresIn and issues one authorization code. See Pushed authorization requests.

requestUriResolver (input) => Promise<Record<string, string> | null>

Resolves a request_uri at the authorize endpoint for pushed authorization requests (RFC 9126 §4). Return null for an unknown or expired URI. With pushedAuthorizationRequests.enabled, the authorize endpoint first looks up values that /oauth2/par issued. It calls the resolver for any value it does not hold, including one that expired or already issued its code, so return null for values you did not issue.

Discovery keeps request_uri_parameter_supported: false when you set a resolver. That field covers request objects that the server fetches from a URL the client hosts (OpenID Connect Core §6.2), which the authorize endpoint does not support. A pushed request_uri does not depend on it (RFC 9126 §5).

Storage and generation

storeClientSecret "hashed" | "encrypted" | { hash, verify? } | { encrypt, decrypt }

How client secrets are stored. Hashing requires the JWT plugin; encryption requires disableJwtPlugin. Defaults to "hashed", or "encrypted" with disableJwtPlugin. See Storage.

storeTokens "hashed" | { hash }

How opaque access tokens and refresh tokens are stored. Defaults to "hashed".

prefix { opaqueAccessToken?, refreshToken?, clientSecret? }

Prefixes added to returned values and not stored. Set them before your first deployment; after that, add the prefix in the matching generate* function instead.

generateClientId () => string

Generates client IDs. Defaults to 32 random letters.

generateClientSecret () => string

Generates client secrets. Defaults to 32 random letters.

generateOpaqueAccessToken () => Awaitable<string>

Generates opaque access tokens. Defaults to 32 random letters.

generateRefreshToken () => Awaitable<string>

Generates refresh tokens. Defaults to 32 random letters.

Other

rateLimit object

Per-endpoint rate limits. For the defaults, see Rate limits.

extensions OAuthProviderExtension[]

Companion extensions. Plugins usually call extendOAuthProvider() instead. See Provider extensions.

schema object

Custom model and field names for the plugin tables.

Endpoints

Paths are relative to your auth base path. Each entry lists the HTTP methods, the server method on auth.api, and how the endpoint authenticates. A server-only endpoint is callable through auth.api only. Every other endpoint is also reachable over HTTP.

/.well-known/oauth-authorization-server GET

Server method: getOAuthServerConfig, which is server-only. Auth: none. The auth handler also serves the document over HTTP at its issuer-relative path (RFC 8414 §3). See Expose the well-known metadata.

/.well-known/openid-configuration GET

Server method: getOpenIdConfig, which is server-only. Auth: none. When scopes includes openid, the auth handler also serves the document over HTTP at its issuer-relative path.

/oauth2/authorize GET, POST

Server method: oauth2Authorize. Auth: session, or a redirect to loginPage.

/oauth2/consent POST

Server method: oauth2Consent. Auth: session and signed oauth_query.

/oauth2/continue POST

Server method: oauth2Continue. Auth: session and signed oauth_query.

/oauth2/token POST

Server method: oauth2Token. Auth: client authentication.

/oauth2/par POST

Server method: oauth2PushedAuthorizationRequest. Auth: client authentication, or client_id for a public client. Returns 404 unless pushedAuthorizationRequests.enabled is true and grantTypes includes authorization_code. See Pushed authorization requests.

/oauth2/introspect POST

Server method: oauth2Introspect. Auth: client authentication.

/oauth2/revoke POST

Server method: oauth2Revoke. Auth: client authentication.

/oauth2/userinfo GET, POST

Server method: oauth2UserInfo. Auth: access token with the openid scope.

/oauth2/end-session GET, POST

Server method: oauth2EndSession. Auth: id_token_hint, or user confirmation.

/oauth2/end-session/confirm POST

No server method. Auth: signed confirmation cookie. HTTP only.

/oauth2/register POST

Server method: registerOAuthClient. Auth: session, initial access token, or none.

/admin/oauth2/create-client POST

Server method: adminCreateOAuthClient. Auth: server call with a session. Server-only.

/admin/oauth2/update-client PATCH

Server method: adminUpdateOAuthClient. Auth: server call with a session. Server-only.

/oauth2/create-client POST

Server method: createOAuthClient. Auth: session.

/oauth2/get-client GET

Server method: getOAuthClient. Auth: session.

/oauth2/public-client GET

Server method: getOAuthClientPublic. Auth: session.

/oauth2/public-client-prelogin POST

Server method: getOAuthClientPublicPrelogin. Auth: signed oauth_query. The endpoint requires allowPublicClientPrelogin.

/oauth2/get-clients GET

Server method: getOAuthClients. Auth: session.

/oauth2/update-client POST

Server method: updateOAuthClient. Auth: session.

/oauth2/client/rotate-secret POST

Server method: rotateClientSecret. Auth: session.

/oauth2/client/rotate-keys POST

Server method: rotateClientKeys. Auth: client assertion.

/oauth2/delete-client POST

Server method: deleteOAuthClient. Auth: session.

/oauth2/get-consent GET

Server method: getOAuthConsent. Auth: session.

/oauth2/get-consents GET

Server method: getOAuthConsents. Auth: session.

/oauth2/update-consent POST

Server method: updateOAuthConsent. Auth: session. Replaces the consent's scopes and leaves the tokens issued under it valid. See Manage consents.

/oauth2/delete-consent POST

Server method: deleteOAuthConsent. Auth: session. Also revokes the tokens issued under the consent. See Revoke tokens with a consent.

/admin/oauth2/resources POST

Server method: adminCreateOAuthResource. Auth: session and resourcePrivileges. Server-only.

/admin/oauth2/resources GET

Server method: adminListOAuthResources. Auth: session and resourcePrivileges. Server-only.

/admin/oauth2/resources/:identifier GET

Server method: adminGetOAuthResource. Auth: session and resourcePrivileges. Server-only.

/admin/oauth2/resources/:identifier PATCH

Server method: adminUpdateOAuthResource. Auth: session and resourcePrivileges. Server-only.

/admin/oauth2/resources/:identifier DELETE

Server method: adminDeleteOAuthResource. Auth: session and resourcePrivileges. Server-only.

/admin/oauth2/resources/:identifier/clients/:client_id POST

Server method: adminLinkClientResource. Auth: session and resourcePrivileges. Server-only.

/admin/oauth2/resources/:identifier/clients/:client_id DELETE

Server method: adminUnlinkClientResource. Auth: session and resourcePrivileges. Server-only.

In the browser, oauthProviderClient() forwards the signed oauth_query from the page URL in JSON object and form-encoded bodies for methods other than GET and DELETE. See Sign-in flow. /oauth2/register rejects requests unless allowDynamicClientRegistration is on, and /oauth2/client/rotate-keys unless allowClientKeyRotation is on.

Some endpoints behave differently with other plugins or requests:

  • With oauthDeviceAuthorization(), /oauth2/authorize also accepts user_code instead of an authorization request. The user approves the device code on the same pages. See Device code grant.
  • With ciba(), /oauth2/authorize also accepts ciba_request_id. The user approves the backchannel request on the same pages. See What the user sees. When you set approvalPage, /oauth2/authorize skips the CIBA interaction for ciba_request_id. Your server records the decision with completeCibaRequest. See Approve only in your own app.
  • During a browser navigation, /oauth2/end-session can return the front-channel logout page.
  • /oauth2/token, /oauth2/introspect, and /oauth2/revoke return 400 invalid_request for a parameter sent more than once. At the token endpoint, only resource and audience may repeat.

Token errors

Errors use the RFC 6749 §5.2 format. The built-in grants authenticate the client before they look up the grant, so an unknown client_id returns invalid_client, not invalid_grant.

Every 401 from an endpoint that authenticates a client or an access token carries a WWW-Authenticate challenge, as RFC 9110 §15.5.2 requires. A client-authentication failure that the endpoint reports as 401 carries WWW-Authenticate: Basic realm="oauth" (RFC 7617 §2). If the client sent an Authorization header with another scheme, the challenge names that scheme instead. When allowUnauthenticatedClientRegistration is off, client registration without a session or an initial access token returns 401 with a bare Bearer challenge.

The token endpoint reports most client-authentication failures as 400 with no challenge, as RFC 6749 §5.2 allows. It returns 401 with a challenge when the client authenticated through the Authorization header, and for a private_key_jwt assertion from a registered client that fails the JWT library's verification: signature, issuer, subject, audience, expiry, or not-before. Other assertion failures stay 400 with no challenge, such as an unsupported client_assertion_type or signing algorithm, a malformed assertion, a client_id that does not match the assertion, a client that is unknown, disabled, or not registered for private_key_jwt, client keys that are missing or cannot be fetched, a missing exp, an iat older than assertionMaxLifetime, an exp further out than assertionMaxLifetime, a missing jti, and a jti that was already used. The iat and exp limits each allow an extra assertionClockTolerance seconds. Every one of them returns the invalid_client error code.

The response also lists WWW-Authenticate in Access-Control-Expose-Headers, so a browser client on another origin can read the challenge. Names that a hook already exposed stay in the list.

The end-session endpoint does not follow the rule that every 401 carries a challenge. It authenticates with id_token_hint, not with an HTTP scheme. Its 401 responses carry no WWW-Authenticate challenge, although RFC 9110 §15.5.2 says a 401 response must carry one. The endpoint returns 401 invalid_client when the client has not enabled end-session, and 401 invalid_token for an invalid hint when no browser confirmation applies. See RP-initiated logout.

The token endpoint answers a request with missing client credentials by grant:

  • A request that carries no client identity returns invalid_request. The identity can come from the form client_id, the Authorization header, or a private_key_jwt assertion.
  • A request that names a confidential client but sends no secret returns invalid_client on the client_credentials and refresh_token grants. A client registered for private_key_jwt that sends no valid assertion gets the same error. A valid assertion authenticates the client instead of a secret.
  • On the authorization_code grant, a request with a client_id but neither a secret, a client assertion, nor a code_verifier returns invalid_request. The endpoint checks for one of them before it looks up the client. With a code_verifier and no secret, a confidential client that sends no secret and no assertion gets invalid_client.

RFC 6749 §5.2 lists "no client authentication included" under invalid_client. The invalid_request answers depart from that text.

invalid_request 400

Returned when a required request field is missing or malformed, or a parameter is sent more than once. Only resource and audience may repeat.

invalid_client 400

Returned in any of these cases:

  • Client authentication fails.
  • The client uses a method other than its registered token_endpoint_auth_method.

invalid_client 401

Returned when client_secret_basic authentication fails or a private_key_jwt assertion fails verification. The response carries WWW-Authenticate: Basic realm="oauth".

invalid_grant 400

Returned when the code, refresh token, or PKCE verifier is invalid, expired, or issued to another client.

invalid_user 400

Returned when the user who approved an authorization code was deleted before the code was exchanged.

unauthorized_client 400

Returned in any of these cases:

  • The client is not registered for the grant.
  • A public client uses client_credentials.
  • The client has no client_credentials scopes.

unsupported_grant_type 400

Returned when the grant is not in grantTypes and no extension handles it.

invalid_scope 400

Returned in any of these cases:

  • A requested scope is not allowed for the client.
  • No scope is allowed for a requested resource.

invalid_target 400

Returned in any of these cases:

  • A resource is malformed, unknown, or disabled.
  • A resource is not linked to the client while enforcePerClientResources is on.
  • The requested resources use different access token formats.

invalid_dpop_proof 400

Returned when the DPoP proof is missing or invalid for a DPoP-bound client or resource.

use_dpop_nonce 400

Returned when dpop.nonce.required is on and the DPoP proof has no nonce, or one that expired or that this server did not issue. The DPoP-Nonce response header carries the nonce to retry with. The UserInfo endpoint returns the same error with a 401 and a WWW-Authenticate: DPoP challenge.

Token exchange has its own conditions for these errors. See Token exchange errors.

Authorization codes and device codes are single-use, and the token endpoint consumes one only after the request passes validation. A request rejected for its code_verifier, redirect_uri, resource, client, or DPoP proof or nonce leaves the code redeemable until it expires, so the client can retry with a corrected request. When the token endpoint checks the request's DPoP proof, this includes a proof whose jti was already used, because the server records the jti before it consumes the code. A device code request whose clientAuthentication strategy returns a confirmation is bound to that confirmation, and its DPoP proof is not checked.

Presenting an authorization code that was already redeemed returns invalid_grant. When the client the code was issued to presents it, the provider also revokes the code's grant, as described in Authorization code reuse. When that client sends two requests that redeem the same code at once:

  • If both carry the same DPoP proof, one can receive tokens. A request that finds the proof's jti already recorded fails with invalid_dpop_proof before it reaches the code, so it is not a reuse and revokes nothing.
  • Otherwise, the second is a reuse: it fails and revokes the grant. The first request also fails with invalid_grant, unless it finished issuing its tokens before the revocation started. In that case, the revocation revokes the tokens it returned, as for any reuse.

When adminCreateOAuthClient links resources, an invalid identifier fails validation with VALIDATION_ERROR, an unknown or disabled resource returns invalid_target, and a resourcePrivileges denial returns 401. The call creates nothing in each case.

Rate limits

Limits apply per IP and per endpoint, and only when Entro Auth rate limiting is enabled, which by default is production only.

Option keyEndpointWindowMax
token/oauth2/token60s20
authorize/oauth2/authorize60s30
introspect/oauth2/introspect60s100
revoke/oauth2/revoke60s30
register/oauth2/register60s5
rotateClientKeys/oauth2/client/rotate-keys60s5
userinfo/oauth2/userinfo60s60
par/oauth2/par60s20

The par limit applies only when pushedAuthorizationRequests.enabled is true.

Override a limit with { window, max }, or set it to false to fall back to the global limits:

auth.ts
oauthProvider({
  rateLimit: {
    token: { window: 60, max: 50 },
    introspect: false,
  },
})

Provider extensions

Companion plugins call extendOAuthProvider() from their init() hook to add token grants, assertion-based client authentication, discovery metadata, claims, token response fields, issuance checks, client registration metadata, client-id discovery, and interaction requests. The CIMD plugin uses this to add URL-based client discovery.

An interaction request is a request other than an authorization request that the user approves through the /oauth2/authorize sign-in, account selection, post-login, and consent pages. It is approved when the user accepts consent, instead of issuing an authorization code. oauthDeviceAuthorization() uses one keyed by user_code, and ciba() one keyed by ciba_request_id, unless you set its approvalPage.

The provider confirms the session in the session store before it calls the handler's approve or deny. With session.cookieCache, a session revoked in the store can still be served from the cache, and such a session cannot approve or deny. Without a server-side session store, the signed cookie is the session record and is trusted. The handler does not repeat this check. The user is sent to the handler's errorPage, or to the provider error page, with access_denied.

Add companion plugins such as oauthDeviceAuthorization() and oauthTokenExchange() to every entroAuth() instance that registers OAuth clients, including a separate admin or provisioning instance. An instance without the plugin does not support its extension grant:

  • createOAuthClient, adminCreateOAuthClient, and client updates reject the grant with invalid_client_metadata.
  • Dynamic registration drops the grant and registers the client with its other supported grants. It fails with invalid_client_metadata only when no supported grant remains.
  • A client metadata document keeps the grant, and the token endpoint refuses it with unsupported_grant_type. The document fails with invalid_client_metadata only when it lists no supported grant.
custom-oauth-extension.ts
import type { EntroAuthPlugin } from "@entro314labs/entro-auth";
import { extendOAuthProvider } from "@entro314labs/entro-auth-oauth-provider";

export const customOAuthExtension = () =>
  ({
    id: "custom-oauth-extension",
    init(ctx) {
      extendOAuthProvider(ctx, {
        name: "custom-oauth-extension",
        grants: {
          "urn:example:params:oauth:grant-type:custom": async ({ provider }) => {
            const scopes = ["openid"];
            // Passing the scopes checks them against the client's registered
            // scopes. Without them, the call only authenticates the client.
            const { client } = await provider.authenticateClient({ scopes });
            return provider.issueTokens({ client, scopes });
          },
        },
        metadata: () => ({ custom_grant_supported: true }),
      });
    },
  }) satisfies EntroAuthPlugin;
  • Give the extension a name, usually your plugin's id. Setup errors and warnings use it to say which extensions conflict. Without a name, they describe the extension by its position in registration order and, when it registers a client discovery, grant type, auth method, or interaction request, one of those, such as unnamed extension #2 (grant type "urn:example:grant"). An extension that registers none of these shows only its position, such as unnamed extension #2. Extensions from oauthProvider({ extensions }) come first, followed by each plugin's extension in plugins order. The name is optional, is not stored, and does not have to be unique.
  • grants, clientAuthentication, and interactionRequests must not overlap across extensions. A duplicate grant type, auth method, assertion type, or interaction parameter fails at startup. Extension grants and auth methods are advertised in discovery.
  • beforeTokenIssuance refuses an issuance by throwing, like the option of the same name. Every extension's callback runs, in registration order, before the option's. A grant that redeems a stored request, such as a device code, can pass it to issueTokens as grantRequest, and every beforeTokenIssuance receives it.
  • metadata and claims only add keys. A key the provider owns is kept, even one it leaves unset because a feature is off, and so is a key a client discovery's discoveryMetadata sets. When two client discoveries set the same key, the later one wins. A metadata key two extensions both contribute as lists is combined in registration order, without duplicates. Any other key two extensions contribute resolves to the first one registered.
  • tokenResponseFields adds fields to the token endpoint's JSON response, such as a session handle your protocol returns with the tokens. It receives the same input as beforeTokenIssuance and runs for every grant after it, before any token is stored. Check grantType or verificationValue to add fields only to responses for your own grant or codes. The nine fields the provider owns are left out with a warning. When two extensions add the same field, the first one registered keeps it, and the customTokenResponseFields option overrides both. See Token response fields.
  • Discovery logs a warning for each contribution it ignores, once per server rather than on every request. To advertise extension claims, set advertisedMetadata.claims_supported.
  • A clientDiscovery entry has a stable id stored as client provenance. Changing it requires migrating the owned clients, and removing it makes them fail closed.

A grant handler receives provider (getClient, authenticateClient, validateAuthorizationRequest, issueAuthorizationCode, resolveConfirmation, issueTokens, verifyDpopProof, issueDpopNonce, challengeDpopNonce, hashToken, validateAccessToken, requireActiveAccessToken, verifyResourceRequest, resolveSubject). Other endpoints get the same object from getOAuthProviderApi(ctx, opts, grantType?). Without grantType, issueTokens throws. validateAccessToken can return an inactive payload. requireActiveAccessToken rejects an inactive token, and a DPoP-bound token, which it has no proof to check against. A protected endpoint should call verifyResourceRequest({ scopes?, audience? }), which also enforces the DPoP binding, the audience, and the scopes. See Endpoints on the auth server. For a token issued to a user, all three return the user ID in sub, even when the token's sub is pairwise. resolveSubject({ userId, client }) returns the sub that client sees in ID tokens and UserInfo. issueAuthorizationCode({ query, session, amr?, serverContext? }) returns an authorization code for a signed-in user without a redirect. See Issue codes from your own endpoint. validateAuthorizationRequest({ query }) checks a request before the user signs in. It issues no code, stores no pushed request, and records no DPoP proof. See Validate the request before the user signs in.

issueTokens applies the provider's resource policy. Each resource must be registered and enabled, and linked to the client while enforcePerClientResources is on (the default). Each resource's allowedScopes also applies. It does not re-check anything else it is given. Validate the user, the client's registered scopes, and any grant-specific policy in your handler before calling it. Pass scopes to authenticateClient so a client cannot obtain scopes it was never registered for.

When a companion endpoint accepts application/x-www-form-urlencoded, set cloneRequest: true in its endpoint options before calling authenticateClient(). Client authentication re-reads the raw form body to check that client credentials are not repeated or combined across authentication methods. The endpoint must therefore keep a readable request after parsing the form.

Some companion endpoints take several requests to finish, such as a sign-in that returns a session handle the client sends back on its next request. The handle already names the client, so the later requests can leave out client_id. Pass the client your endpoint stored with the handle as clientId:

const { client } = await provider.authenticateClient({
  clientId: pending.clientId,
  requireCredentials: false,
});
  • A request that names no client is authenticated as clientId, by the rules of that client's registered authentication method. A confidential client must still send its credentials, even with requireCredentials: false.
  • A client_id, Basic credentials, or a client assertion for another client fails with invalid_client.

Without clientId, a request that names no client fails with invalid_request.

When clientId is undefined, the call behaves as if you had not passed it, and the request is authenticated as whichever client it names. Reject an unknown or expired handle before you call authenticateClient(), so a missing lookup cannot remove the binding.

A public client sends no credentials, so for a public client the handle is the only thing that ties a request to the flow. Anyone who holds the handle can continue the flow as that client. To prevent this, bind the handle to the client's DPoP key with expectedJkt.

On the request that issues the code, you can call authenticateClient() (after challengeDpopNonce() when dpop.nonce.required is on, so a proof without a nonce does not use up a one-time client assertion) before you check the user's credentials. issueAuthorizationCode then reuses its result instead of authenticating again. Without that call, set client_id in the issueAuthorizationCode query to the stored client, and the method authenticates the request as that client by the same rules.

To issue a delegated token, pass the actor chain as act to issueTokens:

  • Validate each actor before you pass it. issueTokens writes act as given, like sub.
  • Set sub_profile: "service" on each entry whose sub is a client ID. A pairwise client sees every other entry's sub as a user's pairwise value.
  • A delegated issuance includes no refresh token, even with offline_access, because refreshed tokens do not carry act. Passing act with refreshToken throws.

issueTokens issues an ID token when scopes include openid and you pass a user. A grant that keeps openid so the client can call UserInfo, but has no sign-in for an ID token to describe, can pass idToken: false:

  • The response has no id_token, and no ID token claim callback runs.
  • Passing idTokenClaims or refreshToken with idToken: false throws.
  • The response has no refresh token either, even with offline_access. A refresh issues an ID token for openid, so a refresh token would bring back the ID token you left out. The client requests new tokens through the grant again.

The built-in authorization code and CIBA grants issue an ID token for openid, as OIDC Core §3.1.3.3 and CIBA Core §10.1.1 require. Entro Auth also issues one when a refresh retains openid, although OIDC Core §12.2 makes it optional. With disableJwtPlugin: true, a public client receives no ID token because it has no secret to sign with.

To bind a token with cnf (RFC 7800 §3), pass confirmation to issueTokens. A clientAuthentication strategy can also return the sender constraint it proved as confirmation, such as a DPoP key thumbprint (jkt) or a certificate thumbprint (x5t#S256):

  • The built-in client_credentials grant binds its token to that confirmation.
  • An extension grant receives it from authenticateClient() and passes it to issueTokens.
  • The built-in authorization_code and refresh_token grants do not use it.

With a jkt confirmation, the token response has token_type: DPoP. The client must then send a DPoP proof signed by that key when it calls a protected resource.

A confirmation that is not a DPoP key cannot replace a required DPoP binding. When the client is registered with dpop_bound_access_tokens: true, or a resource sets dpopBoundAccessTokensRequired: true, issuance with such a confirmation fails with invalid_dpop_proof. provider.resolveConfirmation() fails the same way, so a grant that calls it before consuming a one-time credential keeps that credential for a retry.

A confirmation has exactly one member, and its value is a non-empty string: jkt for a DPoP key, or x5t#S256 for an mTLS certificate. A confirmation with any other shape fails the request with server_error. This applies whether a clientAuthentication strategy returns it or you pass it to issueTokens or resolveConfirmation. No token is issued.

Claim contributors cannot set cnf.

A clientAuthentication strategy must return the same confirmation whenever the client proves the same key. Token exchange compares it with the cnf of the client's own subject token.

A grant that consumes a one-time credential, such as a device code, should resolve the binding before it claims the credential. provider.resolveConfirmation({ client, scopes, resources, confirmation }) returns the confirmation the client proved at authentication. Without one, it verifies the request's DPoP proof by the same rules issueTokens applies. Pass the result to issueTokens as confirmation. A rejected proof then fails before the credential is consumed, so the client can retry with a valid one.

Let issueTokens consume the credential too, so that beforeTokenIssuance can still refuse the request. Pass a consumeCredential function that claims the credential, and the credential's stored request as grantRequest. The provider calls consumeCredential once, after beforeTokenIssuance accepts and before it resolves customTokenResponseFields, extension ID token claims, and access token claims or stores a token. A beforeTokenIssuance refusal leaves the credential for another attempt, but an error thrown from those later callbacks spends it. Throw from it when a concurrent request consumed the credential first. Without consumeCredential, consume the credential before you call issueTokens, and a refusal spends it.

const request = await findApprovedRequest(authReqId);

return provider.issueTokens({
  client,
  scopes,
  user,
  confirmation,
  grantRequest: request,
  consumeCredential: async () => {
    if (!(await claimRequest(request.id))) {
      throw new APIError("BAD_REQUEST", { error: "invalid_grant" });
    }
  },
});

To stop a stolen DPoP-bound token from being reissued under another key, a grant that reissues an existing token can require that token's key. Verify the existing token first. When the caller is the client the token was issued to, pass the token's key thumbprint as expectedJkt, as the built-in refresh and token exchange grants do. Another party, such as a resource server, cannot hold that key.

import { getConfirmationJkt } from "@entro314labs/entro-auth/oauth2";

const confirmation = await provider.resolveConfirmation({
  client,
  scopes,
  resources,
  confirmation: authenticated.confirmation,
  expectedJkt: getConfirmationJkt(verifiedToken.cnf),
});

The request must then carry a DPoP proof signed by that key, or client authentication must return a confirmation with the same jkt. A returned confirmation replaces the proof, so one with another key fails even when the proof uses the expected key. Anything else fails with invalid_dpop_proof, including an mTLS confirmation. With dpop.nonce.required, a proof without a current nonce gets use_dpop_nonce instead, so the client can retry. If the existing token is not DPoP-bound, getConfirmationJkt returns undefined and the usual rules apply.

Client registration metadata

An extension that defines its own client registration fields, such as CIBA's backchannel_token_delivery_mode, declares them in clientMetadata. The provider stores the fields in the client's metadata. validate runs whenever a client is registered through /oauth2/register or a client metadata document, or an admin creates or updates it. A bad value is therefore rejected with invalid_client_metadata at registration, not when the client first uses it.

extendOAuthProvider(ctx, {
  clientMetadata: {
    fields: ["example_mode"],
    validate: ({ metadata }) => {
      if (metadata.example_mode !== undefined && metadata.example_mode !== "ok") {
        throw new APIError("BAD_REQUEST", {
          error: "invalid_client_metadata",
          error_description: "example_mode must be ok",
        });
      }
    },
  },
});

Dynamic registration ignores top-level fields it does not recognize (RFC 7591 §2). Fields an extension declares are the exception:

  • A registrant sends them as top-level fields, and the provider stores them in metadata. A registrant cannot set any other metadata key.
  • An admin sets the same fields inside metadata.
  • A client metadata document carries them as top-level members of the document. The document owns those fields: each refresh replaces them in metadata, removing any it no longer declares, and keeps other metadata keys, such as ones an admin set.

An extension cannot declare a core client field such as redirect_uris, or a server-owned field such as disabled, reference_id, or client_credentials_scopes. The provider rejects these at setup. validate receives the core registration metadata after defaults as client, and the client's metadata. Read extension fields from metadata.

Client authentication obligations

A clientAuthentication strategy proves which client sent the assertion and returns its clientId. The provider loads and authorizes the client record itself. After verifying the signature, the strategy must bind the audience, bound the lifetime, and reject replayed jti values (RFC 7523 §3). consumeClientAssertion performs all three:

import { consumeClientAssertion } from "@entro314labs/entro-auth-oauth-provider";

authenticate: async ({ ctx, opts, assertion, acceptedAudiences }) => {
  const payload = await verifyAssertionSignature(assertion); // your key source
  await consumeClientAssertion(ctx, opts, {
    namespace: `urn:example:attestation:${payload.sub}`,
    payload,
    acceptedAudiences,
  });
  return { clientId: payload.sub };
};

acceptedAudiences holds the aud values the provider accepts at the endpoint called, as set by the assertionAudience option:

  • "issuer" (default): only the issuer. consumeClientAssertion then requires every aud value to be the issuer.
  • "issuer-or-endpoint": the URL of the endpoint called, the issuer, and at /oauth2/par also the token endpoint URL. consumeClientAssertion then requires one aud value to be in the list.

The strategy input also has expectedAudience, the URL of the endpoint called. It is deprecated. A strategy that checks aud against it accepts different audiences than the built-in private_key_jwt method does. Pass acceptedAudiences to consumeClientAssertion instead. consumeClientAssertion still accepts expectedAudience. It maps that endpoint URL to the audiences assertionAudience accepts there, so by default an assertion signed for the endpoint URL is rejected and only the issuer is accepted.

Claim precedence

Extension claims only add claim names. Your own callbacks can override profile claims. The provider always owns identity, lifetime, binding, and authentication-context claims.

TokenOrder, lowest to highest authorityOwned by the provider
Access tokenextension claims.accessToken < per-issuance accessTokenClaims < customAccessTokenClaims < per-resource customClaimsiss, sub, aud, exp, iat, jti, client_id, scope, auth_time, acr, amr, cnf, act, reference_id, ba_sub, and grant_id when revocableJwtAccessTokens is on, stripped before signing. The provider also sets azp and sid after contributed claims.
ID tokensubject and authentication claims < customIdTokenClaims. Extension and per-issuance idTokenClaims only add names and cannot set profile or email claims.iss, sub, aud, exp, nbf, iat, jti, nonce, sid, at_hash, c_hash, s_hash, auth_time, acr, amr, azp
UserInfoscope and claims.userinfo claims < extension claims.userInfo (add only) < customUserInfoClaimssub, applied last

A claim set to undefined in any of these sources is left out, so a lower-priority claim with the same name keeps its value. To override a claim, set a value, such as null.

When a grant issues RFC 9396 authorization details, such as the details a user approves for a CIBA request, the access token's authorization_details claim holds only the details for that token. No other source can replace them or add any.

Introspection returns per-issuance accessTokenClaims for both token formats. The provider issues a JWT access token when the request names a resource and the JWT plugin is enabled, and an opaque access token otherwise (Token endpoint). A JWT access token carries the claims in its signed payload. An opaque access token stores them as JSON in the accessTokenClaims column of oauthAccessToken, after removing the provider-owned names, and introspection merges them back in the same order as the table above. Only clients allowed to introspect the token receive them.

Stored claims stay in the database until the token row is deleted. Keep personal data out of them when the resource server can look it up instead. Values read back in their JSON form, as they would from a JWT, so pass JSON-serializable values.

Token response fields

The provider owns nine token response fields: access_token, token_type, expires_in, expires_at, refresh_token, scope, id_token, issued_token_type, and authorization_details. The first seven are the standard fields. Three sources can add other fields to the response, and each treats the nine differently:

SourceThe seven standard fieldsissued_token_typeauthorization_details
extension tokenResponseFieldsLeft out, with a warningLeft out, with a warningLeft out, with a warning
customTokenResponseFieldsThe provider's value replaces them. A value for refresh_token or id_token is dropped when the provider issues noneReserved but not removed, so do not return itReserved. Replaced when the issuance has details, so do not return it
issueTokens({ tokenResponse })The provider's value replaces them. A value for refresh_token or id_token is dropped when the provider issues noneAllowed. The grant owns it, as token exchange doesReplaced when the issuance has details

When two sources add the same field, issueTokens({ tokenResponse }) overrides customTokenResponseFields, which overrides an extension. When two extensions add the same field, the first one registered keeps it.

Schema

The plugin adds the following tables. Run npx @entro314labs/entro-auth-cli generate for the exact schema of your adapter.

OAuth Client

Table Name: oauthClient

Table
Field
Type
Attributes
Description
id
string
PK
Database ID of the client
clientId
string
UQ
Public client identifier
clientSecret ?
string
-
Hashed or encrypted secret. Absent for public clients.
clientDiscoveryId ?
string
-
ID of the client discovery that owns this client, such as `cimd`
disabled ?
boolean
-
Whether the client is disabled. Defaults to `false`.
skipConsent ?
boolean
-
Whether the consent screen is skipped
enableEndSession ?
boolean
-
Whether the client can use `/oauth2/end-session`
subjectType ?
string
-
`public` or `pairwise`
sectorIdentifier ?
string
-
Pairwise sector the server assigns when the client is created. Empty for clients created before sectors were stored, which use the host of their first redirect URI.
scopes ?
string[]
-
Scopes the client may request for users
clientCredentialsScopes ?
string[]
-
Scopes allowed for `client_credentials`. Empty denies the grant.
userId ?
string
FK
Owning user
referenceId ?
string
-
Owning reference when the owner is not a user
createdAt ?
Date
-
Creation time
updatedAt ?
Date
-
Last update time
expiresAt ?
Date
-
When the client secret expires. Empty means it never expires.
name ?
string
-
Display name
uri ?
string
-
Client website
icon ?
string
-
Logo URI
contacts ?
string[]
-
Contact addresses
tos ?
string
-
Terms of service URI
policy ?
string
-
Privacy policy URI
softwareId ?
string
-
Software identifier, stable across versions
softwareVersion ?
string
-
Software version
softwareStatement ?
string
-
Signed software statement JWT
redirectUris
string[]
-
Registered redirect URIs
postLogoutRedirectUris ?
string[]
-
Registered post-logout redirect URIs
backchannelLogoutUri ?
string
-
URI that receives logout tokens
backchannelLogoutSessionRequired ?
boolean
-
Whether every logout token must carry `sid`
frontchannelLogoutUri ?
string
-
URI loaded in a hidden iframe on the logout page when the user's session ends
frontchannelLogoutSessionRequired ?
boolean
-
Whether the client requires `iss` and `sid` on its front-channel logout URI. Stored for registration round-trips, because Entro Auth always sends both.
tokenEndpointAuthMethod ?
string
-
`none`, `client_secret_basic`, `client_secret_post`, `private_key_jwt`, or an extension method
applicationType ?
string
-
`web` or `native`
jwks ?
string
-
Inline public JWK Set as JSON. Exclusive with `jwksUri`.
jwksUri ?
string
-
HTTPS URI of the public JWK Set. Exclusive with `jwks`.
grantTypes ?
string[]
-
Allowed grant types
responseTypes ?
string[]
-
Allowed response types. Only `code`.
requirePKCE ?
boolean
-
Whether PKCE is required
dpopBoundAccessTokens ?
boolean
-
Whether tokens must be DPoP-bound. Defaults to `false`.
requirePushedAuthorizationRequests ?
boolean
-
Whether authorization requests must use a pushed authorization request. Defaults to `false`.
metadata ?
json
-
Additional client metadata

OAuth Resource

Table Name: oauthResource

A null policy field uses the plugin default at issuance.

Table
Field
Type
Attributes
Description
id
string
PK
Database ID of the resource
identifier
string
UQ
`resource` parameter value and `aud` claim
name
string
-
Display name
accessTokenTtl ?
number
-
Access token lifetime in seconds
refreshTokenTtl ?
number
-
Refresh token lifetime in seconds
accessTokenFormat ?
string
-
`jwt` or `opaque`
signingAlgorithm ?
string
-
JWS algorithm for access tokens
signingKeyId ?
string
-
Signing key ID for access tokens
allowedScopes ?
string[]
-
Scopes allowed for this resource. Requested scopes are narrowed to this set. `null` or `[]` means no restriction.
customClaims ?
json
-
Claims added to access tokens. Reserved names are stripped.
dpopBoundAccessTokensRequired ?
boolean
-
Whether access tokens must be DPoP-bound. Defaults to `false`.
disabled ?
boolean
-
Stops new issuance. Existing tokens verify until they expire. Defaults to `false`.
createdAt ?
Date
-
Creation time
updatedAt ?
Date
-
Last update time
policyVersion ?
number
-
Policy format version. Defaults to `1`.
metadata ?
json
-
Additional resource metadata

OAuth Client Resource

Table Name: oauthClientResource

Links a client to a resource. The pair (clientId, resourceId) is unique. enforcePerClientResources controls whether authorization and token requests check these rows. Introspection always uses them to decide whether a resource server can introspect another client's token.

Table
Field
Type
Attributes
Description
id
string
PK
Database ID of the link
clientId
string
FK
Linked client
resourceId
string
FK
Linked resource identifier
metadata ?
json
-
Additional link metadata
createdAt ?
Date
-
Creation time

OAuth Refresh Token

Table Name: oauthRefreshToken

Table
Field
Type
Attributes
Description
id
string
PK
Database ID of the refresh token
token
string
UQ
Stored token value
clientId
string
FK
Client the token was issued to
sessionId ?
string
FK
Session at issuance
userId
string
FK
User the token was issued for
referenceId ?
string
-
Consent reference
authorizationCodeId ?
string
-
Authorization code that started this token family
grantId ?
string
-
Grant shared by every rotation, used to revoke the grant's access tokens. Empty on rows stored before the column existed; such a row gets one at its next rotation
resources ?
string[]
-
Resources the token may request
requestedUserInfoClaims ?
string[]
-
UserInfo claims requested with `claims`
scopes
string[]
-
Granted scopes
revoked ?
Date
-
When the token stopped being active
rotatedAt ?
Date
-
When rotation consumed the token
rotationReplayResponse ?
string
-
Encrypted response replayed within `refreshTokenReuseInterval`
rotationReplayExpiresAt ?
Date
-
When the replay window ends
authTime ?
Date
-
Original authentication time, kept for `auth_time`
acr ?
string
-
Authentication context class asserted at authorization, kept across rotation for refreshed ID tokens
amr ?
string[]
-
Authentication methods asserted at authorization, kept across rotation for refreshed ID tokens
confirmation ?
json
-
`cnf` binding, such as a DPoP key thumbprint
createdAt
Date
-
Creation time
expiresAt
Date
-
Expiry time

OAuth Access Token

Table Name: oauthAccessToken

Stores opaque access tokens only. JWT access tokens are not stored.

Table
Field
Type
Attributes
Description
id
string
PK
Database ID of the access token
token
string
UQ
Stored token value
clientId
string
FK
Client the token was issued to
sessionId ?
string
FK
Session at issuance
userId ?
string
FK
User the token was issued for. Absent for `client_credentials`.
referenceId ?
string
-
Consent reference
authorizationCodeId ?
string
-
Authorization code that started this token family
refreshId ?
string
FK
Refresh token this access token belongs to
grantId ?
string
-
Grant of the refresh token issued with this token, used to revoke it with any refresh token of the grant. Empty when the token was issued without a refresh token. Also empty on rows stored before the column existed; such a token is revoked only with its own refresh token
resources ?
string[]
-
Resources the token is valid for
requestedUserInfoClaims ?
string[]
-
UserInfo claims requested with `claims`
scopes
string[]
-
Granted scopes
revoked ?
Date
-
When the token was revoked
confirmation ?
json
-
`cnf` binding, returned by introspection
act ?
json
-
`act` actor chain of a delegated token exchange, returned by introspection
accessTokenClaims ?
json
-
Per-issuance `accessTokenClaims` from `issueTokens`, returned by introspection
createdAt
Date
-
Creation time
expiresAt
Date
-
Expiry time

Table Name: oauthConsent

Holds what a user approved for a client under one consent reference. See Stored consent.

Table
Field
Type
Attributes
Description
id
string
PK
Database ID of the consent
clientId
string
FK
Client the consent was given to
userId ?
string
FK
User who consented
referenceId ?
string
-
Consent reference
resources ?
string[]
-
Consented resources
requestedUserInfoClaims ?
string[]
-
Consented UserInfo claims
scopes
string[]
-
Consented scopes
createdAt
Date
-
Creation time
updatedAt
Date
-
Last update time

OAuth Client Assertion

Table Name: oauthClientAssertion

Records each private_key_jwt assertion jti so it can be used once. The check needs string IDs, so with advanced.database.generateId: "serial" Entro Auth logs a warning. Rows are never pruned; delete expired rows.

Table
Field
Type
Attributes
Description
id
string
PK
Digest of the client ID and assertion `jti`
expiresAt
Date
-
When the row is safe to delete

Optimizations

Database adapters may map clientId on oauthClient to id for faster lookups. The id column must then accept strings shaped like UUIDs and URLs.

On this page