Edit

Share via


CustomAuthAccountData class

Constructors

CustomAuthAccountData(AccountInfo, CustomAuthBrowserConfiguration, CustomAuthSilentCacheClient, Logger, string)

Methods

getAccessToken(AccessTokenRetrievalInputs)

Gets the access token of current account from browser cache if it is not expired, otherwise renew the token using cached refresh token if valid. If no refresh token is found or it is expired, then throws error.

getAccount()
getClaims()

Gets the id token claims extracted from raw IdToken of current account.

getIdToken()

Gets the raw id-token of current account. Idtoken is only issued if openid scope is present in the scopes parameter when requesting for tokens, otherwise will return undefined from the response.

signOut()

This method triggers a sign-out operation, which removes the current account info and its tokens from browser cache. If sign-out successfully, redirect the page to postLogoutRedirectUri if provided in the configuration.

Constructor Details

CustomAuthAccountData(AccountInfo, CustomAuthBrowserConfiguration, CustomAuthSilentCacheClient, Logger, string)

new CustomAuthAccountData(account: AccountInfo, config: CustomAuthBrowserConfiguration, cacheClient: CustomAuthSilentCacheClient, logger: Logger, correlationId: string)

Parameters

account
AccountInfo
config

CustomAuthBrowserConfiguration

cacheClient

CustomAuthSilentCacheClient

logger
Logger
correlationId

string

Method Details

getAccessToken(AccessTokenRetrievalInputs)

Gets the access token of current account from browser cache if it is not expired, otherwise renew the token using cached refresh token if valid. If no refresh token is found or it is expired, then throws error.

function getAccessToken(accessTokenRetrievalInputs: AccessTokenRetrievalInputs): Promise<GetAccessTokenResult>

Parameters

accessTokenRetrievalInputs
AccessTokenRetrievalInputs

The inputs for retrieving the access token.

Returns

The result of the operation.

getAccount()

function getAccount(): AccountInfo

Returns

getClaims()

Gets the id token claims extracted from raw IdToken of current account.

function getClaims(): undefined | AuthTokenClaims

Returns

undefined | AuthTokenClaims

The token claims.

getIdToken()

Gets the raw id-token of current account. Idtoken is only issued if openid scope is present in the scopes parameter when requesting for tokens, otherwise will return undefined from the response.

function getIdToken(): undefined | string

Returns

undefined | string

The account id-token.

signOut()

This method triggers a sign-out operation, which removes the current account info and its tokens from browser cache. If sign-out successfully, redirect the page to postLogoutRedirectUri if provided in the configuration.

function signOut(): Promise<SignOutResult>

Returns

Promise<SignOutResult>

The result of the SignOut operation.