Skip to main content
Version: 1.13.1

Function: createCantonAuthorizationCodeProvider()

createCantonAuthorizationCodeProvider(config: AuthorizationCodeAuthConfig, initialToken: AccessToken, fetchToken: () => Promise<AccessToken>, options?: OAuthRequestOptions): CantonAuthorizationCodeProvider

Defined in: canton/authentication/authorization-code.ts:461

Create an AuthorizationCodeProvider from an initial token and a re-fetch callback.

Convenience wrapper around the AuthorizationCodeProvider constructor. The embedder is responsible for obtaining initialToken via the protocol helpers (buildAuthorizationRequestvalidateAuthorizationCallbackexchangeAuthorizationCode).

Parameters

ParameterTypeDescription
configAuthorizationCodeAuthConfigAuthorization code config (used for refresh).
initialTokenAccessTokenThe token obtained from the interactive flow.
fetchToken() => Promise<AccessToken>Called when the cached token expires and refresh fails.
options?OAuthRequestOptionsOptional fetch override and abort signal.

Returns

CantonAuthorizationCodeProvider

A AuthorizationCodeProvider.