The Complete Guide to Vue User Authentication with Auth0

Learn how to add user authentication to Vue using a plugin.

Sounds great to me! Let us know when you have the article added :grinning:

Hi there, thank you for your helpful article!

I do want to ask if it is possible to include the “audience” parameter in the plugin installation, so that token can be stored somewhere after instantiation of AuthService, for example in Vuex store, and then each time when we try to call an API we don’t have to call getTokenSilently() beforehand?

Sorry I’m still kind of a newbie, thank you again!

1 Like

Thanks!
Very interesting and useful article.
Only a couple of questions:

  1. I was not able to find any mention in the documentation of screen_hint: "signup" to allow users to land directly on a sign-up page (docs)
  2. For “logout” to work correctly I had to specify returnTo logoutOption into this.$auth.logout(); while this.$router.push({ path: "/" }); did not worked as expected (home page into a different VUE single page component)
1 Like

Hello, virac! Thank you for reading the blog post.
What do you mean exactly by this:

if it is possible to include the “audience” parameter in the plugin installation

Howdy, Ferlito! I am glad that you enjoyed reading this blog post :slight_smile:

  1. This is the document that explains that configuration option: https://auth0.com/docs/universal-login/new-experience#signup
  2. Could you elaborate more on this use case? What did you expect to happen and what did actually happen?

Thanks!

Sorry for not being clear enough, I saw this at the end of the blog post:

Your previous login request did not include an audience parameter. As such, the Auth0 SPA SDK doesn’t have an access token stored in memory.

I read it somewhere that the Auth0 SPA SDK actually calls getSilentToken() when the auth service instance is initiated. Is it possible to store the acquired access token in Vuex store? Currently for each API call I have to run getSilentToken() beforehand, so I’ve been wondering if this is efficient enough.

Thank you for your reply!

Hi dan-auth0,strong text
to correctly logout in the example app I had to use in NavBar.vue:

methods: {
login() {
this.$auth.loginWithRedirect()
},
logout() {
this.$auth.logout({ returnTo: ‘http://localhost:3000’ })
//this.$router.push({ path: ‘/’ }) // this does not work
}
},

Using this.$router.push({path:’/’}) nothing happens!!
Hope that now is all clear enough.

This topic was automatically closed 26 days after the last reply. New replies are no longer allowed.