tokens

Token Source Code and Refresh Token Source Code

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

Token methods

get()

Universally get token.

this.$auth.token.get()

set(token)

Universally set token. It also set request header.

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

sync()

Universally sync token. It also sync request header.

this.$auth.token.sync()

reset()

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

this.$auth.token.reset()

status()

Get token status.

this.$auth.token.status()

unknown()

Check if status in unknown.

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

valid()

Check if status in valid.

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

expired()

Check if status in expired.

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

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

Refresh Token methods

get()

Universally get refresh token.

this.$auth.refreshToken.get()

set(token)

Universally set refresh token.

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

sync()

Universally sync refresh token.

this.$auth.refreshToken.sync()

reset()

Universally set refresh token to false.

this.$auth.refreshToken.reset()

status()

Get token status.

this.$auth.refreshToken.status()

unknown()

Check if status in unknown.

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

valid()

Check if status in valid.

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

expired()

Check if status in expired.

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

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