I've tried using the snippet codes on handling error but it is returning an error. I need to catch the error when the user inputs and invalid credentials.
Here are the things I've done
export default function({ $auth }) {
$auth.onError((error, name, endpoint) => {
console.error(name, error)
})
}
{
plugins:['@/plugins/auth.js'],
}
It is returning Cannot read property 'onError' of undefined.
Thanks
Hello @ikristher i had the same error with v4.0.0-rc.3. My workaround is use app param in destructuring.
Example
export default function({ app }) {
app.$auth.onError((error, name, endpoint) => {
console.error(name, error)
})
}
This work fine but when I try to use $auth into vue file I got same error
this.$auth.login({
data: {
username: this.username,
password: this.password
}
});
Hi. With 4.0.0 you can now handle login errors.
Still have the same problem with ^4.2.0
Any fix for this ?
Works for me, could be worth double checking your plugins are declared inside the auth (rather than the regular place you setup nuxt plugins)
{
modules: {
'@nuxtjs/auth'
},
auth: {
plugins: [ '~/plugins/auth.js' ]
}
}
Most helpful comment
Works for me, could be worth double checking your
pluginsare declared inside theauth(rather than the regular place you setup nuxt plugins)https://auth.nuxtjs.org/recipes/extend.html