Files
better-auth/docs/content
Gustavo Valverde ec6284f30d feat(oauth-provider): approve self-registered clients at consent
Add approvePendingClient. With it defined, a client created by open
dynamic registration or discovered through CIMD stays pending until a
user consents. A pending client cannot authenticate at the token,
introspection, revocation, or device authorization endpoints, and the
authorization endpoint always sends its users to consent. A pending
client must register authorization_code, since consent is the only way
to approve it. Registrations by a signed-in user or with an initial
access token are not pending.

When the user accepts, the callback names the owner (clientReference).
The update is conditional on the client still being pending and
ownerless and runs in the same transaction as the consent, so concurrent
approvals produce one winner and an owned client is never reassigned.
Returning false redirects to the client with access_denied, like a
denied consent.

Approval grants no machine access. Open registration may request
client_credentials, but the scope limit is still assigned only through
adminUpdateOAuthClient, which clientPrivileges gates.

A CIMD refresh no longer writes the scope limit, disabled, skipConsent,
or enableEndSession from its pre-fetch snapshot, so a change committed
during the fetch is kept.

Without the option, behavior is unchanged. Adds a nullable pending
column to oauthClient.
2026-10-15 15:52:59 +01:00
..