tokens

Token Source Code and Refresh Token Source Code

Token and Refresh Token are available on $auth.strategy.token and $auth.strategy.refreshToken. Both have getters and setters and other helpers.

Token methods

get()

Universally get token.

this.$auth.strategy.token.get()

set(token)

Universally set token. It also set request header.

this.$auth.strategy.token.set('...')

sync()

Universally sync token. It also sync request header.

this.$auth.strategy.token.sync()

reset()

Universally set token to false. It also clear request header.

this.$auth.strategy.token.reset()

status()

Get token status.

this.$auth.strategy.token.status()

unknown()

Check if status is unknown.

this.$auth.strategy.token.status().unknown()

valid()

Check if status is valid.

this.$auth.strategy.token.status().valid()

expired()

Check if status is expired.

this.$auth.strategy.token.status().expired()

::: tip Call this.$auth.strategy.token.status() once and assign it to a variable :::

Refresh Token methods

get()

Universally get refresh token.

this.$auth.strategy.refreshToken.get()

set(token)

Universally set refresh token.

this.$auth.strategy.refreshToken.set('...')

sync()

Universally sync refresh token.

this.$auth.strategy.refreshToken.sync()

reset()

Universally set refresh token to false.

this.$auth.strategy.refreshToken.reset()

status()

Get token status.

this.$auth.strategy.refreshToken.status()

unknown()

Check if status is unknown.

this.$auth.strategy.refreshToken.status().unknown()

valid()

Check if status is valid.

this.$auth.strategy.refreshToken.status().valid()

expired()

Check if status is expired.

this.$auth.strategy.refreshToken.status().expired()

::: tip Call this.$auth.strategy.refreshToken.status() once and assign it to a variable :::

Edit this page on GitHub Updated at Sun, Aug 4, 2024