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.
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:
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:
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.