# How does Auth0 determine when to throw login\_required error during silent authentication?

**URL:** <https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [December 9, 2024, 6:15pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736 "2024-12-09T18:15:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GabrielYamamoto](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gabrielyamamoto/32/61888_2.png) [@GabrielYamamoto](https://community.auth0.com/u/GabrielYamamoto)\
**Post date:** [December 9, 2024, 6:15pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736/1 "2024-12-09T18:15:21Z")

</div>

In documentation, I can see that this error is due to: The user was not logged in at Auth0, so silent authentication is not possible. This error can occur based on the way the tenant-level **Log In Session Management** settings are configured; specifically, it can occur after the time period set in the **Require log in after** setting. See [Configure Session Lifetime Settings](https://auth0.com/docs/dashboard/guides/tenants/configure-session-lifetime-settings) for details.

What do you mean by “user was not logged in at Auth0”?

Because, my user is logged in, I can access all his data in my application (React) using `useAuth0` hook. I try to do get access token silently to other audience right after the user is logged in and receive this error.

Does it have something to do with cookies or localstorage? What is necessary for Auth0 to determine the user as logged in?

PS: I’m using refresh token rotation in my application.

Thank you.

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 10, 2024, 4:26pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736/3 "2024-12-10T16:26:05Z")

</div>

Hi @GabrielYamamoto,

“User was not logged in at Auth0” means that the user did not have a valid session at Auth0. Please see these docs on sessions:

- [Sessions](https://auth0.com/docs/manage-users/sessions)
- [Session Management for SPAs](https://auth0.com/docs/manage-users/sessions#session-management-for-spas)
- [Session Layers](https://auth0.com/docs/manage-users/sessions/session-layers)

Can you confirm my understanding of your use case? Your user authenticates into your app with audienceA and then once logged in you call `getAccessTokenSilently()` with audienceB? If I’m misunderstanding, please let me know! As much info/code snippets/screenshots will be helpful as well!

The key with silent auth and the `login_required` error is that whenever it is returned, the user must be redirected back to the Auth0 login page without the `prompt=none` parameter to re-authenticate. Please see here for more: [Configure Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication#error-responses)

Thanks,

Mary Beth

---

<div class="post-metadata">

**Author:** ![GabrielYamamoto](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gabrielyamamoto/32/61888_2.png) [@GabrielYamamoto](https://community.auth0.com/u/GabrielYamamoto)\
**Post date:** [December 10, 2024, 8:31pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736/4 "2024-12-10T20:31:20Z")

</div>

Hello, Mary!

Thank you for your reply.

Actually, my scenario is that: User authenticates into my app with no audiences (default /authorize Universal Login Page) and then once logged in I call `getAccessTokenSilently()` with audienceB. Should this work?

Because I can’t ask for my user to login for every audience… That would make the app unusable!

I’ll take a time to read your documentation. Thank you.

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 10, 2024, 10:25pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736/5 "2024-12-10T22:25:23Z")

</div>

Hi @GabrielYamamoto,

Yes, that should work. I just wanted to confirm!

So the user logs in, you call `getAccessTokenSilently()` with audienceB, and immediately get the “login\_required” error? This [solution](https://community.auth0.com/t/update-token-after-updating-user-info/87140/5) explains what `getAccessTokenSilently()` does. I wonder if you could try having the user authenticate with an audience and see if this changes anything.

Here are some other articles I found that may prove useful:

- [Calling the getAccessTokenSilently API Returns the Same Access Token](https://community.auth0.com/t/calling-the-getaccesstokensilently-api-returns-the-same-access-token/134411)
- [GetAccessTokenSilently - #3 by stephanie.chamblee](https://community.auth0.com/t/getaccesstokensilently/59860/3)

Thanks,

Mary Beth

---

<div class="post-metadata">

**Author:** ![GabrielYamamoto](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gabrielyamamoto/32/61888_2.png) [@GabrielYamamoto](https://community.auth0.com/u/GabrielYamamoto)\
**Post date:** [December 11, 2024, 2:49pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736/6 "2024-12-11T14:49:58Z")

</div>

The user logs in, I call `getAccessTokenSilently()` with audienceB, and immediately get the “login\_required” error.

I think that’s due to the user logging in a browser and to me calling the function in an Electron app (which you don’t seem to support).  
Once the user logs in the browser, their session is stored there, so I can’t use that in other “browser”, because the `handleRedirectCallback()` function doesn’t do all the work necessary to set a session.

Do you know any ways to work around this? Any ways to pass the session from the browser to an Electron app (basically another browser)?

Thank you

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 17, 2024, 6:13pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736/7 "2024-12-17T18:13:07Z")

</div>

Hi @GabrielYamamoto,

Unfortunately, it is not possible to pass or transfer the session to another browser. Please see here for more information on that: [Is it Possible to Implement Cross-Browser SSO?](https://community.auth0.com/t/is-it-possible-to-implement-cross-browser-sso/119476)

I would recommend submitting feedback about this following this guide: [How to Submit Product Feedback or Feature Requests](https://community.auth0.com/t/how-to-submit-product-feedback-or-feature-requests/22150)

Thanks,

Mary Beth

---

<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:** [January 13, 2025, 6:14pm UTC](https://community.auth0.com/t/how-does-auth0-determine-when-to-throw-login-required-error-during-silent-authentication/159736/8 "2025-01-13T18:14:14Z")

</div>

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