Skip to main content

@wildix/auth-utils > XbsTokenProvider

XbsTokenProvider class

The XbsTokenProvider class is a token provider implementation that facilitates the retrieval of access tokens for the XBS User.

Example Usage:

const tokenProvider = new XbsTokenProvider('autotests-xbees+gststage3autotest@wildix.com', 'OTP', 'stage');

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 XbsTokenProvider implements TokenProvider 

Implements: TokenProvider

Constructors

Constructor

Modifiers

Description

(constructor)(email, otp, env)

Constructs a new instance of the XbsTokenProvider class

Properties

Property

Modifiers

Type

Description

cachedToken

string | undefined

cachedTokenTtl

number | undefined

client

CognitoIdentityProviderClient

clientId

string

email

string

env

XbsTokenEnv

otp

XbsOtp

Methods

Method

Modifiers

Description

token()