Function: completeAuthorization()
completeAuthorization(
config,pending,callbackUrl,fetchFn?,nowEpochSeconds?):Promise<TokenSet>
Complete a login: validate the callback against the stored PendingAuthorization, exchange the code at the token endpoint, and validate the returned id_token's binding claims (issuer, audience, expiry, nonce, subject).
Parameters
config
The same config used for beginAuthorization.
pending
Pick<PendingAuthorization, "state" | "nonce" | "codeVerifier">
The state/nonce/codeVerifier persisted at login start.
callbackUrl
string
The full redirect URL the issuer returned to.
fetchFn?
{(input, init?): Promise<Response>; (input, init?): Promise<Response>; (input, init?): Promise<Response>; }
Injectable fetch (defaults to the global).
nowEpochSeconds?
() => number
Injectable clock in epoch seconds (for tests).
Returns
Promise<TokenSet>
The validated TokenSet.
Remarks
The caller must delete the pending state from storage before calling this so a replayed callback can never reuse the verifier (PKCE single-use, docs/24-sdk-design.md D3). Most integrations should use createUpbond instead.
Throws
AuthError on issuer error, missing/invalid callback, state mismatch, a failed token request, or id_token validation failure.