I created an angular 6 app using auth0 and the guide given for angular 2+ development: https://auth0.com/docs/quickstart/spa/angular2/01-login.
Everything worked fine in local host, but when I hosted the website live I am having issue now with logging in. Specifically when I call his.auth0.parseHash in the handleauthentication function just like in the guide, I get an error:
error: “invalid_token”
errorDescription: “Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.”
and the following warning
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://**********.auth0.com/.well-known/jwks.json
In chrome as soon as I click close on the alert, in redirects and works fine. In firefox it just keeps reloading sometimes after a certain seemingly random amount of time it loads. It’s really weird because it works after a bit so theres some timing issue when I serve it live and not localhost. Also, I did add the live domain to the callback and web origin list.
this is the code that calls it(it gets call from the nginit in the app component):
public handleAuthentication(): void {
this.auth0.parseHash((err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
window.location.hash = ‘’;
this.setSession(authResult);
this.router.navigate([‘/home’]);
} else if (err) {
this.router.navigate([‘/home’]);
console.log(err);
alert(Error: ${err.error}. Check the console for further details.
);
}
});
}
Thanks in advance for any help