Class: CantonAuthorizationCodeProvider
Defined in: canton/authentication/authorization-code.ts:96
Authorization code auth provider.
The constructor performs the full interactive flow (browser + callback
server) and resolves once tokens are obtained. The resulting
CachingTokenSource refreshes via the refresh_token grant when the
access token expires.
Implements
Properties
type
readonlytype:"authorizationCode"
Defined in: canton/authentication/authorization-code.ts:97
The auth scheme this provider was built from.
Implementation of
Methods
tokenSource()
tokenSource():
CantonTokenSource
Defined in: canton/authentication/authorization-code.ts:109
Returns the caching token source.
Returns
Implementation of
CantonAuthProvider.tokenSource
fromDirect()
staticfromDirect(config:AuthorizationCodeAuthConfig& {tokenUrl:string; },options?:AuthorizationCodeProviderOptions):Promise<AuthorizationCodeProvider>
Defined in: canton/authentication/authorization-code.ts:204
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:156
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.