Auth0 Home Blog Docs

Parsehash CORS blocked after logging in


I created an angular 6 app using auth0 and the guide given for angular 2+ development:
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://**********

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 = ‘’;
} else if (err) {
alert(Error: ${err.error}. Check the console for further details.);
Thanks in advance for any help