Skip to main content

PersistentTokenStorage

@authgear/capacitor


@authgear/capacitor / PersistentTokenStorage

Class: PersistentTokenStorage

PersistentTokenStorage stores the refresh token in a persistent storage. When the app launches again next time, the refresh token is loaded from the persistent storage. The user is considered authenticated as long as the refresh token is found. However, the validity of the refresh token is not guaranteed. You must call fetchUserInfo to ensure the refresh token is still valid.

Implements​

Constructors​

Constructor​

new PersistentTokenStorage(): PersistentTokenStorage

Returns​

PersistentTokenStorage

Methods​

delRefreshToken()​

delRefreshToken(namespace): Promise<void>

Deletes the refresh token for the specified namespace in the storage.

Parameters​

namespace​

string

Returns​

Promise<void>

Implementation of​

TokenStorage.delRefreshToken


getRefreshToken()​

getRefreshToken(namespace): Promise<string | null>

Retrieves the refresh token associated with a specific namespace in the storage.

Parameters​

namespace​

string

Returns​

Promise<string | null>

Implementation of​

TokenStorage.getRefreshToken


setRefreshToken()​

setRefreshToken(namespace, refreshToken): Promise<void>

Stores a refresh token for a give namespace to the storage.

Parameters​

namespace​

string

refreshToken​

string

Returns​

Promise<void>

Implementation of​

TokenStorage.setRefreshToken