简体   繁体   English

如何在Angular4中配置和使用Auth-0

[英]How to configure and use Auth-0 in Angular4

How to configure Auth-0 in Angular 4 Application,

我已经安装了最新版本的angular-cli,但是我只为Angular2找到了Auth0。

Angular 2 setup will work fine with Angular 4. It's because they are similar to each other (not like angular-js and angular 2, where ng2 have been mostly rewritten). Angular 2的设置可以与Angular 4一起正常工作。这是因为它们彼此相似(不像angular-js和angular 2,其中ng2已被大部分重写)。

EDIT 编辑

As I mentioned in comment below, you should use: 正如我在下面的评论中提到的,您应该使用:

npm install --save auth0-lock

and

npm install --save angular2-jwt

instead of: 代替:

npm install auth0-angular

There are more details available at Auth0 official webiste: https://auth0.com/docs/quickstart/spa/angular2 Auth0官方网站上提供了更多详细信息: https ://auth0.com/docs/quickstart/spa/angular2

Alternatively, you can fork one of official Auth0 github samples for Angular 2+ and customize it for your use. 或者,您可以为Angular 2+派生官方Auth0 github示例之一,并对其进行自定义以供使用。

Auth0 Angular2+ samples: https://github.com/auth0-samples/auth0-angularjs2-systemjs-sample Auth0 Angular2 +示例: https : //github.com/auth0-samples/auth0-angularjs2-systemjs-sample

Here is starting point, follow the setup for Angular 2 and then upgrade to 4 这是起点,请遵循Angular 2的设置,然后升级到4

https://auth0.com/docs/quickstart/spa/angular2 https://auth0.com/docs/quickstart/spa/angular2

angular2-jwt is deprecated. 不推荐使用angular2-jwt。 This means if you're using Angular 5+, you should use auth0/angular-jwt 这意味着如果您使用的是Angular 5+,则应使用auth0 / angular-jwt

More information: https://github.com/auth0/angular2-jwt/issues/449#issuecomment-353022577 更多信息: https : //github.com/auth0/angular2-jwt/issues/449#issuecomment-353022577

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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