Function: exchangeCantonAuthorizationCode()
exchangeCantonAuthorizationCode(
config:AuthorizationCodeAuthConfig,callback:ValidatedCallback,verifier:string,redirectUri:string,options?:OAuthRequestOptions):Promise<AccessToken>
Defined in: canton/authentication/authorization-code.ts:321
Exchange an authorization code for tokens (access + refresh).
Performs the token endpoint request with the PKCE verifier (RFC 7636) and
returns the parsed AccessToken. The embedder should persist the
refreshToken so refreshAuthorizationCodeToken can renew the
access token without re-running the interactive flow.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | AuthorizationCodeAuthConfig | Authorization code config (with authUrl, clientId). |
callback | ValidatedCallback | The ValidatedCallback from validateAuthorizationCallback (carries the branded callbackParams). |
verifier | string | The PKCE code verifier from buildAuthorizationRequest. |
redirectUri | string | The redirect URI used in the authorize request. |
options? | OAuthRequestOptions | Optional fetch override and abort signal. |
Returns
Promise<AccessToken>
The obtained AccessToken (with refreshToken when issued).
Throws
CCIPError (CANTON_AUTH_ERROR) on token exchange failure.