Class: CantonAuthorizationCodeProvider
Defined in: canton/authentication/authorization-code.ts:90
Authorization code auth provider.
The constructor performs the full interactive flow (browser + callback
server) and resolves once tokens are obtained. The internal
CachingTokenSource refreshes via the refresh_token grant when the
access token expires.
Implements
Properties
type
readonlytype:"authorizationCode"
Defined in: canton/authentication/authorization-code.ts:91
The auth scheme this provider was built from.
Implementation of
Methods
token()
token():
Promise<AccessToken>
Defined in: canton/authentication/authorization-code.ts:103
Returns a valid access token, refreshing via the refresh_token grant if needed.
Returns
Promise<AccessToken>
Implementation of
fromDirect()
staticfromDirect(config:AuthorizationCodeAuthConfig& {tokenUrl:string; },options?:AuthorizationCodeProviderOptions):Promise<AuthorizationCodeProvider>
Defined in: canton/authentication/authorization-code.ts:198
Create a provider with explicit authorization and token endpoint URLs.
Performs the full interactive flow (browser + callback server) and resolves
once tokens are obtained. A minimal oauth4webapi.AuthorizationServer is
constructed from the provided endpoint URLs.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | AuthorizationCodeAuthConfig & { tokenUrl: string; } | Authorization code config plus a tokenUrl endpoint. |
options? | AuthorizationCodeProviderOptions | Optional fetch override and stateOverride (for testing). |
Returns
Promise<AuthorizationCodeProvider>
A AuthorizationCodeProvider.
Throws
CCIPError (CANTON_AUTH_ERROR) on invalid config or flow errors.
fromDiscovery()
staticfromDiscovery(config:AuthorizationCodeAuthConfig,options?:AuthorizationCodeProviderOptions):Promise<AuthorizationCodeProvider>
Defined in: canton/authentication/authorization-code.ts:150
Create a provider using OAuth2 Authorization Server Metadata discovery (RFC 8414) to locate the authorization and token endpoints.
Requires the server to advertise S256 PKCE support.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | AuthorizationCodeAuthConfig | Authorization code config with authUrl. |
options? | AuthorizationCodeProviderOptions | Optional fetch override. |
Returns
Promise<AuthorizationCodeProvider>
A AuthorizationCodeProvider.
Throws
CCIPError (CANTON_AUTH_ERROR) on discovery failure, missing S256 support, or callback/flow errors.