# Auth0VueClient.isAuthenticated always returns false after page refresh, checkSession does not help

**URL:** <https://community.auth0.com/t/auth0vueclient-isauthenticated-always-returns-false-after-page-refresh-checksession-does-not-help/100305>\
**Category:** Get Help\
**Tags:** rotating-refresh-tokens, sessions\
**Created:** [February 12, 2023, 4:23pm UTC](https://community.auth0.com/t/auth0vueclient-isauthenticated-always-returns-false-after-page-refresh-checksession-does-not-help/100305 "2023-02-12T16:23:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balthazar](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Balthazar](https://community.auth0.com/u/Balthazar)\
**Post date:** [February 12, 2023, 4:23pm UTC](https://community.auth0.com/t/auth0vueclient-isauthenticated-always-returns-false-after-page-refresh-checksession-does-not-help/100305/1 "2023-02-12T16:23:52Z")

</div>

Hi

I am working on a Vue 3.0 SPA in which some features are password protected with New Universal Login, and no Custom Domain. I’m testing it on localhost. It’s not yet deployed. If I refresh the browser, the UI shows me as not logged in. If I then click login, I don’t have to enter username and password again, it just logs in directly, as if I was already logged in after all. I’m using the `isAuthenticated` property of the `Auth0VueClient` to see if the user is logged in:

```auto
<script setup lang="ts">

  import { useAuth0 } from "@auth0/auth0-vue";
  const { isAuthenticated } = useAuth0();
  
</script>

<template>
    <div v-if="!isAuthenticated">
    	User not logged in...
    </div>
    <div v-else>
    	User logged in...
    </div>
</template>

```

I have looked at [this thread](https://community.auth0.com/t/vue-js-keep-user-logged-in-after-refreshing-browser/28861) and it recommends using `checkSession()`, which apparently is supposed to solve the problem. The `checkSession()` implemented in `Auth0VueClient` returns a `Promise<void>`. According to the thread linked to, I’m supposed to then check `authResult` in my callback, but if it returns a `Promise<void>` there can’t be any `authResult` parameter. So, I tried to simply call `await checkSession()` and recheck `isAuthenticated` after it’s done, but it’s still false.

Surely this problem is meant to be solvable with ‘@auth0/auth0-vue’, which all the quickstart examples for Vue are based on? So I checked this readme

> <https://github.com/auth0/auth0-vue/blob/main/FAQ.md#1-user-is-not-logged-in-after-page-refresh>

Which lists three possible reasons. 1) does not apply. 2) might apply, I’m using Google Chrome. But what does it matter what browser **I** am using if the end user is using another one? Surely it’s not meant to only work for a limited set of browsers? 3) does not apply, however, the proposed solution does work, setting the following settings in `createAuth0`:

```
useRefreshTokens: true,
cacheLocation: 'localstorage',

```

It doesn’t work to only set `useRefreshTokens`, however, from what I gather Auth0 recommends against setting the second setting. So, what should I do?

---

<div class="post-metadata">

**Author:** ![alex.brett](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alex.brett/32/60157_2.png) [@alex.brett](https://community.auth0.com/u/alex.brett)\
**Post date:** [November 21, 2024, 10:00pm UTC](https://community.auth0.com/t/auth0vueclient-isauthenticated-always-returns-false-after-page-refresh-checksession-does-not-help/100305/3 "2024-11-21T22:00:49Z")

</div>

Hello @Balthazar! Welcome to the community.

Using silentAuth() with PKCE is what will securely solve your problem. Here is how you can [Configure Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication). Auth0 highly discourages the use of refresh tokens for SPAs (Single Page Application). Read more about this in the documentation: [Refresh Token Rotation](https://auth0.com/docs/secure/tokens/refresh-tokens/refresh-token-rotation).

I hope this helps!

Best,  
Alex

---

<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:** [December 5, 2024, 10:01pm UTC](https://community.auth0.com/t/auth0vueclient-isauthenticated-always-returns-false-after-page-refresh-checksession-does-not-help/100305/4 "2024-12-05T22:01:27Z")

</div>

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