0
我想從Angular2應用程序使用Auth0登錄。該代碼源自Auth0 sample。它正在工作,但現在的行爲有點奇怪。auth0:令牌數據出現在URL和事件驗證沒有提高
添加到URL令牌數據:
http://localhost:4200/#access_token=0ZoQ3U6Ma2tAhQnh&id_token=eyJ0e...jqd&token_type=Bearer
事件authenticated
沒有提出:
@Injectable()
export class Auth0Service {
// Configure Auth0
lock = new Auth0Lock('I21EAjbbpfPh...', 'xxx.au.auth0.com', {});
constructor() {
// Add callback for lock `authenticated` event
this.lock.on("authenticated", (authResult) => {
// Use the token in authResult to getProfile() and save it to localStorage
this.lock.getProfile(authResult.idToken, function(error, profile) {
if (error) {
// Handle error
return;
}
localStorage.setItem('id_token', authResult.idToken);
localStorage.setItem('profile', JSON.stringify(profile));
});
});
}
...
任何想法,請?
[angular2-auth0:登錄添加散列網址後不工作]的可能的複製(http://stackoverflow.com/questions/39641554/angular2-auth0-the-login-is-not-勞動後加入哈希到URL) –