# Error from handleRedirectCallback: ID token is required but missing

**URL:** <https://community.auth0.com/t/error-from-handleredirectcallback-id-token-is-required-but-missing/67369>\
**Category:** Get Help\
**Tags:** auth0-spa-js, scopes\
**Created:** [August 4, 2021, 11:55am UTC](https://community.auth0.com/t/error-from-handleredirectcallback-id-token-is-required-but-missing/67369 "2021-08-04T11:55:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aartiles](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aartiles/32/30923_2.png) [@aartiles](https://community.auth0.com/u/aartiles)\
**Post date:** [August 4, 2021, 11:55am UTC](https://community.auth0.com/t/error-from-handleredirectcallback-id-token-is-required-but-missing/67369/1 "2021-08-04T11:55:44Z")

</div>

Hello,  
I’m new to Auth0 and I’m trying to migrate our legacy custom-developed authentication flow to Auth0.  
I’m developing a PoC using the auth0/auth0-spa-js SDK following the tutorial at [Auth0 JavaScript SDK Quickstarts: Login](https://auth0.com/docs/quickstart/spa/vanillajs/).

```auto
this.auth0 = createAuth0Client({
  domain: auth_config.domain,
  client_id: auth_config.client_id
});

this.auth0.then(function(auth0) {
  auth0.isAuthenticated().then(function(isAuthenticated) {

    if (isAuthenticated) return;

    var query = window.location.search;
    if (query.includes("code=") && query.includes("state=")) {

      auth0.handleRedirectCallback().then(function() {
        window.history.replaceState({}, document.title, "/");
      }).catch(function(error) {
        console.log('Error from handleRedirectCallback', error);
      });

    }
    else {
      auth0.loginWithRedirect({
        redirect_uri: window.location.origin
      });    
    }

  });
});

```

I see in the browser console the following warning:

```auto
api.ts:45 The requested scopes ([object Set]) are different from the scopes of the retrieved token (). This could mean that your access token may not include all the scopes that you expect. It is advised to resolve this by either:
  
  - Removing `[object Set]` from the scope when requesting a new token.
  - Ensuring `[object Set]` is returned as part of the requested token's scopes.

```

And then `handleRedirectCallback` returns the error:

```auto
Error from handleRedirectCallback Error: ID token is required but missing
    at mo (jwt.ts:65)
    at e._verifyIdToken (Auth0Client.ts:254)
    at e.<anonymous> (Auth0Client.ts:541)
    at tslib.es6.js:99
    at Object.next (tslib.es6.js:80)
    at c (tslib.es6.js:70

```

Do these error messages ring a bell to somebody? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![aartiles](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aartiles/32/30923_2.png) [@aartiles](https://community.auth0.com/u/aartiles)\
**Post date:** [August 9, 2021, 12:32pm UTC](https://community.auth0.com/t/error-from-handleredirectcallback-id-token-is-required-but-missing/67369/2 "2021-08-09T12:32:03Z")

</div>

The problem was a legacy library (mootools) polyfilling `Array.from`

---

<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:** [August 24, 2021, 12:32pm UTC](https://community.auth0.com/t/error-from-handleredirectcallback-id-token-is-required-but-missing/67369/3 "2021-08-24T12:32:04Z")

</div>

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