Skip to main content

@wildix/auth-utils > PbxTokenProvider

PbxTokenProvider class

The PbxTokenProvider class is a token provider implementation that facilitates the retrieval of access tokens for the organization.

Example Usage:

const tokenProvider = new PbxTokenProvider('221100007e84', '<secretKey>');

try {
const token = await tokenProvider.token();
console.log('ID Token:', token);
} catch (error) {
console.error('Error retrieving token:', error);
}

The implementation encapsulates the logic for obtaining and caching access tokens securely, abstracting away the details of the authentication process.

Signature:

export declare class PbxTokenProvider implements TokenProvider 

Implements: TokenProvider

Constructors

Constructor

Modifiers

Description

(constructor)(serial, secret)

Constructs a new instance of the PbxTokenProvider class

Properties

Property

Modifiers

Type

Description

cachedToken

string | undefined

cachedTokenTtl

number | undefined

client

CognitoIdentityProviderClient

clientId

string

secret

string

serial

string

Methods

Method

Modifiers

Description

token()