简体   繁体   中英

Auth0, Angular 4 and ASP.NET Core

So I am trying to add authentication and authorization to my single page app that is running Angular 4 as frontend and ASP.net Core as backend, the issue I am running is that if I follow the tutorials on Auth0.com I cannot integrate it on my spa.

To replicate the issue, I add the auth.service.ts file to my project. Add the services as providers on my modules but when I try to reference it on my component to use the login and logout I get an error telling me this:

Error: Uncaught (in promise): TypeError: Cannot read property 'WebAuth' of undefined

I checked and I have all the services registered, but I cant find what it is about this.

I think, the problem could be in type of importing auth0 library. You should import it like this:

import * as auth0 from 'auth0-js';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM