我正在尝试按照本教程在我的 Angular 5 应用程序中实现 auth0: https: //toddmotto.com/angular-2-authentication
寄存器工作正常,但当我尝试登录时,我在控制台中看到以下内容:
这是我的身份验证服务:
import { Injectable } from '@angular/core';
// We want to avoid any 'name not found'
// warnings from TypeScript
declare var Auth0Lock: any;
@Injectable()
export class AuthService {
private lock
constructor() {
// These stuff should be exported into other files
this.lock = new Auth0Lock('id...',
'url...')
}
login() {
this.lock.show((error: string, profile: Object, id_token: string) => {
if (error) {
console.log(error);
} else {
console.log(profile)
localStorage.setItem('profile', JSON.stringify(profile));
localStorage.setItem('id_token', id_token);
}
}); …Run Code Online (Sandbox Code Playgroud)