I have a React App using Auth0. I basically copy and pasted the code from the quickstart into it. This piece of code no longer works:
handleAuthentication() {
this.auth0.parseHash((err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
this.setSession(authResult);
history.replace('/');
} else if (err) {
history.replace('/');
console.log(err);
alert(`Error: ${err.error}. Check the console for further details.`);
}
});
}
Whenever I try to log in I get an error message “invalid_token. “Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.”
But when I comment out the 'history.replace(”/")’ line in the error handler it works. I get the error pop-up initially but then it goes back and gets the token. I’m not sure what to make of this.