DEV Community

Discussion on: How to make nuxt auth working with JWT - a definitive guide

Collapse
 
jeppepepp profile image
JeppePepp

Hey!

Thanks for the great post. I cant get the $auth instance from the destruction of the app object in the auth.js plugin tho.

//auth.js
export default async function ({ app }) {
const { $axios, $auth } = app <------- $auth is not avaialbe i.e undefined

I dont really understand what I should do to get it avabile in the plugin.
Its availabe in the App it self.
Also $axios (and for med $vueitfy) is instantiated and avaialbe.

Thanks for any tips! :)

/J

Collapse
 
mrnaif2018 profile image
MrNaif2018

To get $auth instance on your app, your plugin should be specified as nuxt auth plugin, not normal nuxt plugin.
Recheck your nuxt.config.js file, I'll be glad to help!

Collapse
 
jeppepepp profile image
JeppePepp

Yes that was it! Thanks!