I'm attempting to get Token auth with Sanctum working with nuxt/auth
but several of the functions don't seem to work.
I have an endpoint that authenticates the user via username/email and password, no issues on the API side of things, it returns a personal access token with the correct scopes.
However, in nuxt/auth
the methods setUserToken
and setUser
should both be able to handle logging in a user, granted in different ways, but neither method is completing what it's supposed to do.
this.$auth.loginWith('sanctum', {
data: this.form
}).then((response) => {
// this should set the token to storage
// then fetch the user with the token
// but it only sets the token to storage
this.$auth.setUserToken(response.data)
.then(() => {
// so I have to fetch the user myself with VuexORM
this.user.api().get('/me')
.then((result) => {
// my user is set to the model, but not to auth
this.$auth.setUser(result.response.data) // sets user but won't set loggedIn to true.
})
})
}).catch((e) => {
console.log(e.message)
})
So at this point with all this failing, am I missing something? Or should I just skip nuxt/auth
altogether?