[英]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. 所以我试图向运行Angular 4的前端和ASP.net Core作为后端的单页应用程序添加身份验证和授权,我运行的问题是,如果我按照Auth0.com上的教程进行操作,则无法对其进行集成我的温泉。
To replicate the issue, I add the auth.service.ts file to my project. 要复制该问题,我将auth.service.ts文件添加到我的项目中。 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. 我认为,问题可能出在导入auth0库的类型上。 You should import it like this:
您应该这样导入:
import * as auth0 from 'auth0-js';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.