Sign in

Class: MonoCloudOidcClientBase

Constructors

Constructor

new MonoCloudOidcClientBase(options: MonoCloudOidcClientBaseOptions): MonoCloudOidcClientBase

Creates a new instance of MonoCloudOidcClientBase.

Parameters

ParameterTypeDescription
optionsMonoCloudOidcClientBaseOptionsBase client configuration options.

Returns

MonoCloudOidcClientBase

Methods

decodeJwt()

static decodeJwt(jwt: string): JwtClaims

Decodes the payload of a JSON Web Token (JWT) and returns it as an object.

Note: THIS METHOD DOES NOT VERIFY JWT TOKENS.

Parameters

ParameterTypeDescription
jwtstringJWT to decode.

Returns

JwtClaims

Decoded payload.

Throws

MonoCloudTokenError - If decoding fails


getJwks()

getJwks(forceRefresh?: boolean): Promise<Jwks>

Fetches the JSON Web Keys used to sign the ID token. The JWKS is cached for 5 minutes by default.

Parameters

ParameterTypeDescription
forceRefreshbooleanIf true, bypasses the cache and fetches fresh set of JWKS from the server.

Returns

Promise<Jwks>

The JSON Web Key Set containing the public keys for token verification.

Throws

MonoCloudHttpError - Thrown if there is a network error during the request or unexpected status code during the request or a serialization error while processing the response.


getMetadata()

getMetadata(forceRefresh?: boolean): Promise<IssuerMetadata>

Fetches the authorization server metadata from the .well-known endpoint. The metadata is cached for 5 minutes by default.

Parameters

ParameterTypeDescription
forceRefreshbooleanIf true, bypasses the cache and fetches fresh metadata from the server.

Returns

Promise<IssuerMetadata>

The issuer metadata for the tenant, retrieved from the OpenID Connect discovery endpoint.

Throws

MonoCloudHttpError - Thrown if there is a network error during the request or unexpected status code during the request or a serialization error while processing the response.

© 2024 MonoCloud. All rights reserved.