# Cannot access authenticated user after login redirection

**URL:** <https://community.auth0.com/t/cannot-access-authenticated-user-after-login-redirection/167850>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [January 8, 2025, 3:49am UTC](https://community.auth0.com/t/cannot-access-authenticated-user-after-login-redirection/167850 "2025-01-08T03:49:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zipporah\_price](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/zipporah_price/32/67664_2.png) [@zipporah\_price](https://community.auth0.com/u/zipporah_price)\
**Post date:** [January 8, 2025, 3:49am UTC](https://community.auth0.com/t/cannot-access-authenticated-user-after-login-redirection/167850/1 "2025-01-08T03:49:06Z")

</div>

Hi,

I am having some trouble with using the login authentication. I am able to redirect to the Auth0 login page and successfully login, but once I am redirected back to my website it seems to have not saved the login authentication/user info. When I call the getUser() function the user is undefined, and the isAuthenticated() function returns false.

I thought it may be an issue with third party cookies but after allowing them it is still an issue. I am unsure how to persist the user information from the Auth0 login page to my website page,

I am using the free trial of Auth0 for my project on the localhost that uses Vue.js and Vitepress (uses very similar config to Vuepress). This is what I have on my main page index.md:

```auto
<div>
<div v-if="user">
      <p align="center">
        Logged in as {{ user }}
      </p>
    </div>
    <div v-else>
      <p align="center">
        NOT LOGGED IN
      </p>
      <p align="center">
        <LoginButton :client="auth0client" @login-complete="getUser()" />
      </p>
      <p align="center">
        <LogoutButton :client="auth0client" />
      </p>
      <p align="center"> Authenticated: {{ authenticated }} </p>
      <p align="center"> auth0client: {{ auth0client }} </p>
    </div>
  </div>

```

```auto
<script>
import auth from "./.vitepress/auth";
import LoginButton from "./.vitepress/theme/components/LoginButton.vue";
import LogoutButton from "./.vitepress/theme/components/LogoutButton.vue";

export default {
  data() {
    return {
      auth0client : null,
      user : null,
      authenticated : null,
    }
  },
  async mounted(){
    this.auth0client = await auth.createClient();
    this.user = await this.auth0client.getUser();
    this.authenticated = await auth.isAuthenticated(this.auth0client);
  },
  methods : {
    async login () {
      await auth.loginWithRedirect(this.auth0client);
    },
    async getUser(){
      this.user = await this.auth0client.getUser();
      console.log(this.user);
    }
  }
}
</script>

```

And this is my login button:

```auto
<template>
    <div>
      <button class="login-button" @click="login()">Sign In</button>      
    </div>
  </template>
  
  <script>
  import auth from "../../auth";

  export default {
    props : ['client'],

  methods: {
    async login() {
      await auth.loginWithRedirect(this.client);
      this.$emit('login-complete');
    }, ...

```

Any ideas on how to get this to work would be very appreciated! FYI it’s my first time using Auth0 so I am not the most experienced with it 🙂

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [January 21, 2025, 2:48pm UTC](https://community.auth0.com/t/cannot-access-authenticated-user-after-login-redirection/167850/3 "2025-01-21T14:48:27Z")

</div>

Hi @zipporah_price

Welcome to the Auth0 Community!

Thank you for posting your question, and I’m sorry for the late response. Did you follow our quickstart guide for Vue? → [Auth0 Vue SDK Quickstarts: Add Login to your Vue App](https://auth0.com/docs/quickstart/spa/vuejs/interactive). It should give you a good working baseline for developing an app on top of it.

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 4, 2025, 2:49pm UTC](https://community.auth0.com/t/cannot-access-authenticated-user-after-login-redirection/167850/4 "2025-02-04T14:49:23Z")

</div>

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