Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manully setting up user token setToken() #227

Closed
roosht3 opened this issue Aug 8, 2018 · 3 comments
Closed

Manully setting up user token setToken() #227

roosht3 opened this issue Aug 8, 2018 · 3 comments

Comments

@roosht3
Copy link

roosht3 commented Aug 8, 2018

What problem does this feature solve?

When a token is added manually Axios doesn't attach the token. As for my auth flow it is required.

What does the proposed changes look like?

When setting a token manually using $auth.setToken calling this.$auth.ctx.app.$axios.setHeader(this.options.tokenName, token) this would solves the manual login problem.

This feature request is available on Nuxt community (#c184)
@ghost ghost added the cmty:feature-request label Aug 8, 2018
@dgwight
Copy link
Contributor

dgwight commented Dec 17, 2018

I also need this feature for registering in or logging in via a password reset.

I got around this by using:

this.$auth.setToken(this.$store.state.auth.strategy, `Bearer ${data.access_token}`)
this.$auth.strategy._setToken(`Bearer ${data.access_token}`)
return this.$auth.fetchUser()

I am going to open a PR with this as a helper function.

** edit
#278

@Anaphase
Copy link

This issue is not resolved by #278. setUserToken() works just fine on it's own, but setToken() still doesn't set the axios auth token.

@JoaoPedroAS51
Copy link
Collaborator

Closing here as auth v5 can set tokens using this.$auth.strategy.token.set(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants