# Auth0-react SDK: GetAccessTokenSilently returns error "Login required" in private browser

**URL:** <https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781>\
**Category:** Get Help\
**Tags:** organizations, jwt, auth0\
**Created:** [May 3, 2022, 6:58am UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781 "2022-05-03T06:58:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandonjolly](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brandonjolly/32/33281_2.png) [@brandonjolly](https://community.auth0.com/u/brandonjolly)\
**Post date:** [May 3, 2022, 6:58am UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/1 "2022-05-03T06:58:29Z")

</div>

Hey all,

Hope you are doing good. I am working on the same method right now.  
Currently, I’m working on react application where I have integrated auth0 login/signup, and also once users log in, they will select the organization and then will continue for the application.

Here are information about SDK I’m using:

- SDK name - “@auth0/auth0-react”
- SDK Version - “^1.9.0”
- react - “^17.0.2”

And I have declared the required config parameters in Auth0Provider,

> {  
> domain: ‘DOMAIN’,  
> clientId: ‘CLIENT\_ID’,  
> redirectUri: ‘LOCATION’,  
> audience: ‘IDENTIFIER\_STRING\_VALUE’,  
> cacheLocation: ‘localstorage’,  
> onRedirectCallback  
> }

Using this, I can allow use to login simply. but when they select any organization from the list, I will pass that organization id in getAccessTokenSilently method to get token silently for the organization.

> await getAccessTokenSilently({  
> organization: ‘ORGANIZATION\_ID’,  
> ignoreCache: true  
> });

Now issue is that it is working fine in chrome and firefox, but when I check with chrome incognito or safari, It is not working and keep returning an error “Login Required”.

Am I missing anything? Please help me with this. Thanks!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 3, 2022, 11:34pm UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/4 "2022-05-03T23:34:35Z")

</div>

Hey there @brandonjolly!

> [@brandonjolly](#):
>
> Now issue is that it is working fine in chrome and firefox, but when I check with chrome incognito or safari, It is not working and keep returning an error “Login Required”.

That’s great to hear that everything is working outside of Incognito and Safari at least! i believe the issue you are seeing is related to the blocking of 3rd party cookies by both Chrome Incognito and Safari as outlined in our `getAccessTokenSilently` [documentation](https://auth0.com/docs/libraries/auth0-single-page-app-sdk?_ga=2.8114554.917577023.1651502383-1067826553.1646348878&_gl=1*ad61h8*rollup_ga*MTA2NzgyNjU1My4xNjQ2MzQ4ODc4*rollup_ga_F1G3E656YZ*MTY1MTYxNzAxMC4zMS4xLjE2NTE2MjA4MDMuNjA.#get-access-token-with-no-interaction):

**Note:** Getting an Access Token silently without using Refresh Tokens will not work in browsers that block third-party cookies, such as Safari and Brave.

Hope this helps to clarify for you!

---

<div class="post-metadata">

**Author:** ![brandonjolly](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brandonjolly/32/33281_2.png) [@brandonjolly](https://community.auth0.com/u/brandonjolly)\
**Post date:** [May 6, 2022, 6:50am UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/5 "2022-05-06T06:50:21Z")

</div>

Hey @ty.frith

Thank you so much for your response. I have tried with _useRefreshTokens=true_ and with this, it is working fine and returning a JWT token without any error, but we are missing the organization id in the token, although I have added **organization** in the getAccessTokenSilently method.

is there any other param I need to add there? Please guide me here. Thanks!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 7, 2022, 1:17am UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/6 "2022-05-07T01:17:38Z")

</div>

No problem, happy to help where I can!

> [@brandonjolly](#):
>
> I have tried with _useRefreshTokens=true_ and with this, it is working fine and returning a JWT token without any error, but we are missing the organization id in the token, although I have added **organization** in the getAccessTokenSilently method.

Good to know everything is working fine regarding refresh tokens - That’s curious the `org_id` is not included in the ID token. Is it included prior to `getAccessTokenSilently` is called?

---

<div class="post-metadata">

**Author:** ![brandonjolly](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brandonjolly/32/33281_2.png) [@brandonjolly](https://community.auth0.com/u/brandonjolly)\
**Post date:** [May 9, 2022, 6:57am UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/7 "2022-05-09T06:57:45Z")

</div>

Hey,

No, It isn’t been added before, because we don’t want specific organization login, login will be common. But after that, we will show the organization list in which the user will be part, and the user will select the organization.  
And based on that we will fetch the new token which included the organization id so that can help us on the API side to identify the data.

---

<div class="post-metadata">

**Author:** ![brandonjolly](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brandonjolly/32/33281_2.png) [@brandonjolly](https://community.auth0.com/u/brandonjolly)\
**Post date:** [May 10, 2022, 9:25am UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/8 "2022-05-10T09:25:17Z")

</div>

Hey @ty.frith

Mentioning you in case you have missed the above reply, please look into it. Thanks!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 11, 2022, 10:07pm UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/9 "2022-05-11T22:07:37Z")

</div>

Hey @brandonjolly sorry just getting around to this!

Are you passing in the org\_id on the silent auth attempt something like this?

> [@User switch between Organization](https://community.auth0.com/t/user-switch-between-organization/62609/7):
>
> It’s not in the docs yet, you just have to pass it, and the sdk will append it to the /authorize request. You have to make sure you do ignoreCache: true so it’s not returning the same access token. You have to make sure the application user is auth against enables organization (it’ll ask if it’s organization only or personal use or both), if your application does not enabled for organization, then when you pass in organization parameter it’ll return an error. Also, if you don’t pass in authoriz…

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 11, 2022, 10:09pm UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/10 "2022-05-11T22:09:24Z")

</div>

Sorry, looping back I see that is the case - I’m still trying to figure out why the org\_id wouldn’t be included in that case 🤔

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 11, 2022, 10:36pm UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/11 "2022-05-11T22:36:50Z")

</div>

A couple ideas in terms of isolating the issue:

- Are you able to locate the org\_id param in the /authorize request associated with the `getAccessTokenSilently` silently call?

- I’d be curious to know if the org\_id is indeed included as a claim in the ID Token if you about this the standard route - That is, by having a user log in and specify the Organization they belong to when they log in. If you’re interested in doing this our [React sample app](https://github.com/auth0-samples/auth0-react-samples) might be the easiest route.

Let us know!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 26, 2022, 10:37pm UTC](https://community.auth0.com/t/auth0-react-sdk-getaccesstokensilently-returns-error-login-required-in-private-browser/82781/12 "2022-05-26T22:37:23Z")

</div>

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