Skip to main content
Version: 1.13.0

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

ParameterTypeDescription
configCantonAuthConfigAuth config (static, clientCredentials, or authorizationCode).
options?OAuthRequestOptionsOptional 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!,
})