Skip to main content
Version: 4.0

Class: AuthConnect

Methods

handleLogoutCallback

handleLogoutCallback(): Promise<void>

Returns

Promise<void>


decodeToken

Static decodeToken<T>(tokenType, auth, parseHeader?): Promise<T>

Returns decoded token data from the specified TokenType.

Usage


_10
const data = await AuthConnect.decodeToken<MyType>(TokenType.id, authResult);

Type parameters

Name
T

Parameters

NameType
tokenTypeTokenType
authAuthResult
parseHeader?boolean

Returns

Promise<T>


expire

Static expire(auth): Promise<AuthResult>

Expire the current access token, but keep the refresh token, useful for testing.

Usage


_10
const expiredAuthResult = await AuthConnect.expire(authResult);

Parameters

NameType
authAuthResult

Returns

Promise<AuthResult>


fetchManifest

Static fetchManifest(discoveryUrl?): Promise<Manifest>

Download the auth provider manifest from the specified discoveryUrl.

Parameters

NameType
discoveryUrl?string

Returns

Promise<Manifest>

Manifest


getAccessTokenExpiration

Static getAccessTokenExpiration(auth): Promise<undefined | number>

Get the time until the access token expires, in milliseconds.

Usage


_10
const expiresIn = await AuthConnect.getAccessTokenExpiration(authResult);

Parameters

NameType
authAuthResult

Returns

Promise<undefined | number>

number


getConfig

Static getConfig(): Promise<AuthConnectConfig>

Get the current configuration object used by AuthConnect

Usage


_10
const config = await AuthConnect.getConfig();

Returns

Promise<AuthConnectConfig>

AuthConnectConfig


getToken

Static getToken(tokenType, auth): Promise<undefined | string>

Get the raw token string from the specified TokenType.

Usage


_10
const tokenString = await AuthConnect.getToken(TokenType.access, authResult);

Parameters

NameType
tokenTypeTokenType
authAuthResult

Returns

Promise<undefined | string>


handleLoginCallback

Static handleLoginCallback(queryEntries): Promise<AuthResult>

Parameters

NameType
queryEntriesObject

Returns

Promise<AuthResult>


isAccessTokenAvailable

Static isAccessTokenAvailable(auth, tokenName?): Promise<boolean>

Checks if access token is available in the provided AuthResult.

Usage


_10
const isAvailable = await AuthConnect.isAccessTokenAvailable(authResult);

Parameters

NameType
authAuthResult
tokenName?string

Returns

Promise<boolean>


isAccessTokenExpired

Static isAccessTokenExpired(auth): Promise<boolean>

Checks if the access token is expired.

Usage


_10
const isExpired = await AuthConnect.isAccessTokenExpired(authResult);

Parameters

NameType
authAuthResult

Returns

Promise<boolean>


isRefreshTokenAvailable

Static isRefreshTokenAvailable(auth): Promise<boolean>

Checks if refresh token is available in the provided AuthResult.

Usage


_10
const isAvailable = await AuthConnect.isRefreshTokenAvailable(authResult);

Parameters

NameType
authAuthResult

Returns

Promise<boolean>


login

Static login(provider, options): Promise<AuthResult>

Display the auth provider's login UI, and begin the login process.

Usage


_10
const result = await AuthConnect.login(getProvider(), myProviderConfig);

Parameters

NameType
providerAuthProvider
optionsProviderOptions

Returns

Promise<AuthResult>

AuthResult


logout

Static logout(provider, auth): Promise<void>

Log the user out of the auth provider.

Usage


_10
await AuthConnect.logout(getProvider(), authResult);

Parameters

NameType
providerAuthProvider
authAuthResult

Returns

Promise<void>


refreshSession

Static refreshSession(provider, auth): Promise<AuthResult>

Refresh the AuthResult session, throws if refresh token is invalid or missing.

Usage


_10
const newAuthResult = await AuthConnect.refreshSession(getProvider(), authResult);

Parameters

NameType
providerAuthProvider
authAuthResult

Returns

Promise<AuthResult>


setup

Static setup(config): Promise<void>

Initialize AuthConnect with platform level configuration.

Usage


_10
await AuthConnect.setup(myConfig);

Parameters

NameType
configAuthConnectConfig

Returns

Promise<void>