Skip to main content

Function: createPendingConsentOnAuthorize()

createPendingConsentOnAuthorize(__namedParameters): (__namedParameters) => Promise<OnAuthorizeResult>

Defined in: auth-core/src/pendingConsent.ts:248

Factory for the onAuthorize hook of an OAuth server whose consent screen lives outside it, holding the authorization request server-side.

Flow:

  1. /authorize (client and redirect_uri already validated) stores a PendingAuthorization and redirects to consentUrl with only its opaque id.
  2. The consent screen loads the request with getConsentRequest and, on approval, calls approveConsentRequest, which records the subject and returns the /authorize URL to resume.
  3. The resumed /authorize carries the id and the one-time resume secret the approver received. When the stored request is approved, unexpired, identical to the incoming one and the secret matches, it is consumed (atomically, single use) and approved; otherwise a fresh consent round starts.

Unlike createRedirectConsentOnAuthorize, nothing the consent screen shows comes from its URL, and an approval is bound to the client, redirect_uri, scopes and PKCE challenge the user saw, and redeemable only by the browser that approved.

Parameters​

ParameterType
__namedParametersCreatePendingConsentOnAuthorizeOptions

Returns​

(__namedParameters) => Promise<OnAuthorizeResult>