Auth-module: Undefined $auth.token

Created on 5 Oct 2020  路  4Comments  路  Source: nuxt-community/auth-module

Both this.$auth.token.get() and this.$auth.refreshToken.get() returns as undefined while user is logged in!
Any ideas why?

Most helpful comment

@iranagame I'm getting the same on most recent commit (@nuxtjs/auth-next": "^5.0.0-1602966760.822bc05). seems odd, did you get around it?

EDIT: this worked, based off this PR https://github.com/nuxt-community/auth-module/commit/bdce83a28b6bc149577cbae15a977b9966ed7cef

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

All 4 comments

are you using v5 @nuxtjs/auth-next ? @nuxtjs-auth so then check out the master branch

@iranagame I'm getting the same on most recent commit (@nuxtjs/auth-next": "^5.0.0-1602966760.822bc05). seems odd, did you get around it?

EDIT: this worked, based off this PR https://github.com/nuxt-community/auth-module/commit/bdce83a28b6bc149577cbae15a977b9966ed7cef

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

i'm in the same situation, so try to downgrade to 4.9.1 but still not working even with @ksherman solution. My work arround was this:

const userToken = $auth.$storage.getUniversal('_token.local')

but I would like to use some other token functions that saw in nuxt-auth docs, but it seems the token object dosn't exist

image

@iranagame I'm getting the same on most recent commit (@nuxtjs/auth-next": "^5.0.0-1602966760.822bc05). seems odd, did you get around it?

EDIT: this worked, based off this PR bdce83a

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

It's work, but why this is not in docs? 馃槶

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Amoki picture Amoki  路  3Comments

weijinnx picture weijinnx  路  3Comments

sebmor picture sebmor  路  3Comments

DougHayward picture DougHayward  路  4Comments

DiegoGallegos4 picture DiegoGallegos4  路  3Comments