Skip to content

Session

Dan M edited this page Mar 31, 2022 · 2 revisions

Session keeps track of all the session data created by AppAuthHelper. It is not recommended to manually edit this data yourself. Instead, keep to the methods within AppAuthHelper.


API

Static Fields

static TokenResponse? tokenResponse

The TokenResponse Object last received from a login or refresh token call.

static String? token

The main token in string form.

static String? refreshToken

The refresh token of the current token.

static Map<String, dynamic> tokenData

Stores the fields within the token, decoded using Jaguar JWT

static DateTime? refreshesAt

The DateTime that the current token expires at and will need to be refreshed before

static Duration refreshBefore

The Duration before the token expires at that it will attempt to refresh. Defaults to Duration(seconds: 10)

Static Methods

static void disableColors()

Disables the colors for the static Session Log object.

static bool onToken(TokenResponse response)

Called when AppAuthHelper receives a token. Returns true if the token was not null

static void startTokenLoop()

Starts the refresh token loop

stopRefreshTokenLoop()

Stops the Alarm that runs the refresh token loop

static void onLogout()

Clears session data

Static Getters

static bool get doRefreshToken

Returns true if the refresh token loop is running

Clone this wiki locally