# Auth0 Token not set in Incognito window

**URL:** <https://community.auth0.com/t/auth0-token-not-set-in-incognito-window/161866>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [December 12, 2024, 2:13pm UTC](https://community.auth0.com/t/auth0-token-not-set-in-incognito-window/161866 "2024-12-12T14:13:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjh1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sjh1/32/61598_2.png) [@sjh1](https://community.auth0.com/u/sjh1)\
**Post date:** [December 12, 2024, 2:13pm UTC](https://community.auth0.com/t/auth0-token-not-set-in-incognito-window/161866/1 "2024-12-12T14:13:56Z")

</div>

When im in incognito mode in browser(any browser) or when 3rd party cookies are blocked, getAccessTokenSilently, throws error ‘login required’, even though i logged in using login form, auth0 cookies are not set. I have custom domain. My angular application is on [authentication.elso.org](http://authentication.elso.org) and auth0 custom domain is [auth.elso.org](http://auth.elso.org). Here is the screenshoot. We are on enterprise plan.

 ![auth0 cookies](https://global.discourse-cdn.com/auth0/original/3X/a/9/a9d826f03bfcdea46aaf3862fa70f18564b9fda4.png)

Here is how my provideAuth0 looks like:

```auto
 provideAuth0({
      domain: 'elso-auth.us.auth0.com',
      clientId: 'myclientid',
      skipRedirectCallback: true, 
      useRefreshTokens: true,
      cacheLocation: 'localstorage',
      useRefreshTokensFallback: true,
      cookieDomain: '.elso.org',
      authorizationParams: {
        redirect_uri: window.location.origin, 
        audience: 'https://elso-auth.us.auth0.com/api/v2/'
        , scope: 'openid profile email offline_access'

      }
    }),

```

---

<div class="post-metadata">

**Author:** ![sjh1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sjh1/32/61598_2.png) [@sjh1](https://community.auth0.com/u/sjh1)\
**Post date:** [December 12, 2024, 10:28pm UTC](https://community.auth0.com/t/auth0-token-not-set-in-incognito-window/161866/3 "2024-12-12T22:28:45Z")

</div>

I figured out one solution to fix this, and another one with with help of Auth0 Support named Rodrigo Uberto.

```auto
this.auth.getAccessTokenSilently().subscribe({
          next: (res) => {
            console.log('logged in BINGO');
          },
          error: (err) => {
            console.log(err);

            if (err.error_description == 'Login required') {
              this.auth.loginWithRedirect();
            }
  

          }
        });

```

Also cacheLocation: ‘localstorage’ for provideAuth0 is required for this to work. Refresh token properties were not important, i tested without them and it worked. Also, previously i had those two logins on separate routs, where first rout called ‘this.auth.loginWithRedirect()’, and i passed redirect parameter to second rout, where getAccessTokenSilently() was called, but that didnt work.

Auth0 support solution was to add custom domain in provideAuth0, ‘domain’ property, looks simple but didnt find precise explanation on that in auth0 documentation. Dont place ‘[our-custom-domain.us.auth0.com](http://our-custom-domain.us.auth0.com)’, place ‘your-custom-domain’. Also if you are validating token in backend .net for example, custom domain name must be placed there also, in ValidIssuer field, and dont use ‘[https://your-custom-domain.us.auth0.com](https://your-custom-domain.us.auth0.com)’ in there also.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [December 12, 2024, 10:53pm UTC](https://community.auth0.com/t/auth0-token-not-set-in-incognito-window/161866/4 "2024-12-12T22:53:32Z")

</div>

Hi @sjh1,

I’m glad you were able to solve this with the help of our Developer Support engineer.

Please feel free to reach out to us again if you have any additional questions.

Thanks,  
Rueben

---

<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 26, 2024, 10:53pm UTC](https://community.auth0.com/t/auth0-token-not-set-in-incognito-window/161866/5 "2024-12-26T22:53:40Z")

</div>

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