# Failed Silent Auth - Login Required error for an unauthenticated user

**URL:** <https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [February 20, 2025, 2:37pm UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499 "2025-02-20T14:37:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yordan.grozdanov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yordan.grozdanov/32/71658_2.png) [@yordan.grozdanov](https://community.auth0.com/u/yordan.grozdanov)\
**Post date:** [February 20, 2025, 2:37pm UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/1 "2025-02-20T14:37:00Z")

</div>

Hello,

I have a SPA set up with Auth0. Every time a user opens the app I get the “Failed Silent Auth - Login Required” error in the logs which creates a lot of noise. Authentication works fine, we also have a refresh token rotation set up which also works fine. I don’t understand why this error is being thrown for every user and I’m trying to resolve it in order to keep the logs clean but I haven’t found the solution yet.

Auth0 SDK is set up like this:

```auto
<Auth0Provider
  domain={process.env.AUTH0_DOMAIN}
  clientId={process.env.AUTH0_CLIENT_ID}
  authorizationParams={{
    redirect_uri: window.location.origin,
    audience: process.env.AUTH0_AUDIENCE,
  }}
  useRefreshTokens={true}
  cacheLocation='localstorage'
>

```

and then there is a hook that calls loginWithRedirect:

```auto
const { isLoading, isAuthenticated, user, loginWithRedirect, getAccessTokenSilently } = useAuth0()

  useEffect(() => {
    if (!isLoading && !isAuthenticated) {
      void loginWithRedirect()
    }
  }, [isLoading, isAuthenticated, loginWithRedirect])

```

On successful login, a token is fetched and the user is authenticated. However, the error is thrown before the user has authenticated, so it’s either isAuthenticated or loginWithRedirect but I don’t get why exactly. The package version is:

```auto
"@auth0/auth0-react": "2.1.1",

```

Any help would be appreciated,  
Thanks!

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [February 20, 2025, 7:52pm UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/3 "2025-02-20T19:52:26Z")

</div>

Hi @yordan.grozdanov

Welcome to the Auth0 Community!

Could you please let me know when does the Failed Auth error appear exactly?  
Does it appear when:

- A user opens the app for the first time?
- A previously authenticated user opens the app?
- An authenticated/unauthenticated user opens the app at any time?

The error states that your application attempts to perform a silent authentication, usually this would be triggered by a `checkSession()` to see if the user is authenticated and if they are not, it throws in this error. Alternatively, it might also be triggered by the getAccessTokenSilently if the user’s session with Auth0 is no longer valid.

I would recommend to implement [Refresh Token Rotation](https://auth0.com/docs/secure/tokens/refresh-tokens/configure-refresh-token-rotation) since it should take care of the issue at hand.

You can also inspect your application to see exactly where is this error being thrown from.

Let me know if you have any other questions regarding the matter, I will be looking forward to your reply.

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![yordan.grozdanov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yordan.grozdanov/32/71658_2.png) [@yordan.grozdanov](https://community.auth0.com/u/yordan.grozdanov)\
**Post date:** [February 21, 2025, 10:29am UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/4 "2025-02-21T10:29:48Z")

</div>

Hi @nik.baleca, thanks for your reply!

The error happens when a user opens the app, as you can see in the code sample I provided we use the “isAuthenticated” function from the SDK to check if the user is authenticated to render the appropriate page or to redirect them to Universal Login via “loginWithRedirect”. We use refresh token rotation, it is already implemented and refreshing the token works as expected.

Is there a way to suppress this error for the “isAuthenticated” check in our use case as it creates a lot of noise in our logs?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [February 24, 2025, 6:12pm UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/5 "2025-02-24T18:12:22Z")

</div>

Hi @yordan.grozdanov

Thank you for the additional info on the matter?

Could you please let me know what is the error that you are receiving in your logs or if you can share via DM the tenant name so I can take a look myself? Usually, the `isAuthenticated()` function should not throw any errors since it is only checking the session, not performing any authentication.

Kind Regards,

Nik

---

<div class="post-metadata">

**Author:** ![yordan.grozdanov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yordan.grozdanov/32/71658_2.png) [@yordan.grozdanov](https://community.auth0.com/u/yordan.grozdanov)\
**Post date:** [February 25, 2025, 5:53pm UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/6 "2025-02-25T17:53:32Z")

</div>

Hi @nik.baleca how can I DM you? I don’t see this option when I click on your profile…

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [February 25, 2025, 5:57pm UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/7 "2025-02-25T17:57:11Z")

</div>

Hi,

When you click my profile icon in the thread, you should have a button on the right which says “ **Message** ”.

---

<div class="post-metadata">

**Author:** ![yordan.grozdanov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yordan.grozdanov/32/71658_2.png) [@yordan.grozdanov](https://community.auth0.com/u/yordan.grozdanov)\
**Post date:** [February 26, 2025, 11:03am UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/8 "2025-02-26T11:03:28Z")

</div>

I was able to resolve this, there was another `getTokenSilently` call that was throwing this error for unauthenticated users. Thanks for your help!

---

<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:** [March 12, 2025, 11:04am UTC](https://community.auth0.com/t/failed-silent-auth-login-required-error-for-an-unauthenticated-user/182499/9 "2025-03-12T11:04:22Z")

</div>

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