# The Complete Guide to Vue User Authentication with Auth0

**URL:** <https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475>\
**Category:** Blog Discussions\
**Created:** [November 18, 2020, 8:41pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475 "2020-11-18T20:41:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [November 18, 2020, 8:41pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/1 "2020-11-18T20:41:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [November 25, 2020, 4:39pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/2 "2020-11-25T16:39:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![virac](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/virac/32/26568_2.png) [@virac](https://community.auth0.com/u/virac)\
**Post date:** [January 1, 2021, 2:12am UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/3 "2021-01-01T02:12:37Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![ferlito.sergio](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ferlito.sergio/32/12949_2.png) [@ferlito.sergio](https://community.auth0.com/u/ferlito.sergio)\
**Post date:** [January 4, 2021, 8:13am UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/4 "2021-01-04T08:13:08Z")

</div>

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](https://auth0.github.io/auth0-spa-js/interfaces/redirectloginoptions.html))
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)

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [January 4, 2021, 9:06pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/5 "2021-01-04T21:06:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [January 4, 2021, 9:09pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/6 "2021-01-04T21:09:19Z")

</div>

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

1. This is the document that explains that configuration option: [New Universal Login Experience](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!

---

<div class="post-metadata">

**Author:** ![virac](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/virac/32/26568_2.png) [@virac](https://community.auth0.com/u/virac)\
**Post date:** [January 5, 2021, 9:23am UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/7 "2021-01-05T09:23:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![ferlito.sergio](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ferlito.sergio/32/12949_2.png) [@ferlito.sergio](https://community.auth0.com/u/ferlito.sergio)\
**Post date:** [January 5, 2021, 4:45pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/8 "2021-01-05T16:45:58Z")

</div>

Hi dan-auth0, **strong text**  
to correctly logout in the example [app](https://github.com/auth0-samples/auth0-vue-samples/tree/master/02-Calling-an-API) I had to use in NavBar.vue:

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

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

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [February 1, 2021, 8:46am UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/9 "2021-02-01T08:46:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 26, 2021, 3:57pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/10 "2021-03-26T15:57:31Z")

</div>



---

<div class="post-metadata">

**Author:** ![velasco](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/velasco/32/29456_2.png) [@velasco](https://community.auth0.com/u/velasco)\
**Post date:** [May 16, 2021, 11:29am UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/12 "2021-05-16T11:29:12Z")

</div>

Hi there, I followed this guide closely as I need to build a vue app with auth0. I was able to reproduce the app in vue 2, without any issues. But I struggle to apply the guide to vue 3. I get two warnings after `npm run serve` which appear to rise due to the migration from vue 2 to 3.

```auto
 warning in ./src/router/index.js

"export 'default' (imported as 'Router') was not found in 'vue-router'

 warning in ./src/main.js

"export 'default' (imported as 'Vue') was not found in 'vue'

```

I would appreciate if someone could look over my code ([https://github.com/velasco/auth0-vue3-sample.git](https://github.com/velasco/auth0-vue3-sample.git)) and help me to debug it. Many thanks

---

<div class="post-metadata">

**Author:** ![salouri](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/salouri/32/33215_2.png) [@salouri](https://community.auth0.com/u/salouri)\
**Post date:** [February 2, 2022, 7:49pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/13 "2022-02-02T19:49:59Z")

</div>

Did you manage to get it working with Vue 3 ? I’m in the same boat as yours and would appreciate any help.  
Thanks

---

<div class="post-metadata">

**Author:** ![salouri](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/salouri/32/33215_2.png) [@salouri](https://community.auth0.com/u/salouri)\
**Post date:** [February 2, 2022, 7:53pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/14 "2022-02-02T19:53:32Z")

</div>

@dan-auth0 Thanks a lot for this amazing tutorial!  
It would be awesome if you can add some notes on how to do it using vue.js version 3.

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [February 2, 2022, 10:30pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/15 "2022-02-02T22:30:32Z")

</div>

We are working on it! 👀 There are exciting things coming to Vue from Auth0! 🎁

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [February 2, 2022, 10:31pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/16 "2022-02-02T22:31:33Z")

</div>

Have you checked out these Vue 3 + Auth0 code samples?

> **[Auth0 Code Samples](https://developer.auth0.com/resources/code-samples)**
>
> Explore how to implement authentication and authorization using different frameworks and languages.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 3, 2022, 10:51am UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/17 "2022-02-03T10:51:38Z")

</div>

Thanks for sharing that Dan!

---

<div class="post-metadata">

**Author:** ![salouri](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/salouri/32/33215_2.png) [@salouri](https://community.auth0.com/u/salouri)\
**Post date:** [February 3, 2022, 3:12pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/18 "2022-02-03T15:12:35Z")

</div>

Yes I looked at them and actually I got it working after mixing between your [Vue.js 2 User Authentication with Auth0](https://auth0.com/blog/complete-guide-to-vue-user-authentication/) and your article [Vue 3/JavaScript Authentication: Basic Access Control](https://auth0.com/developers/hub/code-samples/spa/vue-3-javascript/basic-authentication#quick-auth-0-set-up) … so thanks!

I now have to configure it for an openID Connect protocol.

---

<div class="post-metadata">

**Author:** ![dan-auth0](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dan-auth0](https://community.auth0.com/u/dan-auth0)\
**Post date:** [February 3, 2022, 3:15pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/19 "2022-02-03T15:15:08Z")

</div>

The OIDC profile elements would be present in the ID Token, which is on the `user` object. Are you looking to have more than access to the user profile information?

---

<div class="post-metadata">

**Author:** ![salouri](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/salouri/32/33215_2.png) [@salouri](https://community.auth0.com/u/salouri)\
**Post date:** [February 3, 2022, 3:15pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/20 "2022-02-03T15:15:33Z")

</div>

Even though I got it working for now (on a demo project) I look forward for an official documentation that will make it much easier than what I did. I wonder how much different it will be to tailor it to OpenId Connect though!

---

<div class="post-metadata">

**Author:** ![salouri](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/salouri/32/33215_2.png) [@salouri](https://community.auth0.com/u/salouri)\
**Post date:** [February 4, 2022, 6:21pm UTC](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475/21 "2022-02-04T18:21:17Z")

</div>

I logged the returned data from your **auth0-express-js-sample** application (btw I noticed that _RBAC_ and _CORS_ endpoints were not implemented) and the only different property I see in the user object (on the **Profile** page) is : “sub”, with a value starting with “auth0|”…is that related to the oidc profile? (I’m new to the whole OIDC implementation)

[Next page](https://community.auth0.com/t/the-complete-guide-to-vue-user-authentication-with-auth0/53475.md?page=2)
