Function: resolveCantonJwt()
resolveCantonJwt(
config:CantonAuthConfig,options?:OAuthRequestOptions):Promise<string>
Defined in: canton/authentication/index.ts:188
Resolve a JWT string for Canton Ledger API authentication.
This is a convenience wrapper around createAuthProvider that returns
the raw access token string (suitable for the existing CantonConfig.jwt
field) instead of a provider. It fetches a token immediately.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | CantonAuthConfig | Auth config (static, clientCredentials, or authorizationCode). |
options? | OAuthRequestOptions | Optional fetch override and abort signal. |
Returns
Promise<string>
The JWT access token string.
Throws
CCIPError (CANTON_AUTH_ERROR) on invalid config or auth failure.
Example
TypeScript
const jwt = await resolveCantonJwt({
type: AuthType.ClientCredentials,
authUrl: process.env.CANTON_AUTH_URL!,
clientId: process.env.CANTON_CLIENT_ID!,
clientSecret: process.env.CANTON_CLIENT_SECRET!,
})