Auth0.js: Auth0js parseHash function broken with angular 6

Created on 28 Apr 2018  路  3Comments  路  Source: auth0/auth0.js

Hello everyone,

I'm using the Auth0js library in an Angular 5 project.

When upgrading to Angular 6 RC, the parseHash function is broken, saying "global is not defined".

The reason for that seems to be that angular 6 will remove global as stated here : https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814

Is there a way to upgrade auth0js to make it compatible with angular 6?

Many thanks!

Most helpful comment

@sergewerle
this fixes the issue. In your tscofnig.json compiler options add:

"paths": {
      "auth0-js": ["node_modules/auth0-js/build/auth0.js"]
    }

I've lost the type support, but the code builds/compiles

All 3 comments

It can be done, but this will involve changing a lot of our codebase, since we rely on global being available (we use webpack to build). This might take a while to get started, since we have other priorities right now. I can review a PR if you send one. In the short term, it's best that you use our cdn version until we fix this.

@sergewerle
this fixes the issue. In your tscofnig.json compiler options add:

"paths": {
      "auth0-js": ["node_modules/auth0-js/build/auth0.js"]
    }

I've lost the type support, but the code builds/compiles

THank you @peterblazejewicz it works well now !

I don't know if there's any side effect of doing this but for the moment it seems to be OK !

Was this page helpful?
0 / 5 - 0 ratings