I just decided to try Auth0 for the first time and went through the process of setting up Vue app authentication, following the instructions for a Vue application. Although I’ve made everything work on a new app installation, whenever I login and refresh the page, both the logout button and the Profile link in the menu disappear. Why is this happening and how can I deal with it? The only option I have for logout after page refresh is to delete the browser cookies for localhost.
Welcome to the Auth0 Community Forum!
This is likely because the session is being persisted via a cookie, and the user is being implicitly logged in using silent authentication. This happens during the initialization of the auth0 client in your vue application. Are you not wanting to have the user session persist through page refreshes?
Let me know.
What I want is to give the user an option to log out even when he accidentally refreshes the page. Currently, the user loses access to his profile and the logout option after a refresh. I don’t believe this is a normal behavior and I followed your Vue tutorial to the letter.
I just reproduced it like you described. Let me see what I can find out about a solution.
Okay it was throwing a 400 error for me, and I tracked it down to this error message:
The specified redirect_uri 'http://localhost:3000' does not have a registered origin.
If you remove the trailing
/ from your Allowed Web Origins in the application settings that should solve the problem. Additionally, I am going to let the team know. Thanks for reporting this.
I didn’t have anything in the field Allowed Web Origins. I placed the URL “http://localhost:8080” in it, since a Vue app by default runs on port 8080, and tested it on 2 apps with your authentication. The effect is now different - instead of hiding the profile link and the logout button after refresh, the user is logged out after refresh. Is this how it should be with Auth0?
I have setup exactly as described in the quickstart and was not experiencing that.
Mine works like this:
- In a new incognito window navigate to
- Click login
- login with existing username/password
- refresh the page
- I see nav bar with profile icon and dropdown
In addition, the trailing
/ issue was actually not from the quickstart, but just on my end. Are you seeing any errors in the console?
This is what I’m seeing after a successful login when I hit F5:
There are no errors or warnings on both apps.
This does not look like our quickstart. What resource did you use for this?
I just tested it in a new incognito window. It works as you described it. Thank you for your help.
Let us know if you run into anything else!
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.