相关疑难解决方法(0)

使用Auth0 spa快速入门时出错

我目前正在开发一个Angular 2 Web应用程序,它将使用Auth0进行用户身份验证.

我在Auth0网站上关注了快速入门,但Cannot read property 'WebAuth' of undefined at new AuthService (auth.service.ts:9)即使声明了AuthService,我也收到了错误.

我错过了什么吗?很感谢任何形式的帮助.

这是我的代码

//app.component.ts

import { Component } from '@angular/core';
import { AuthService } from '../../auth/auth.service';

@Component({
    selector: 'app',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {

    constructor(public auth: AuthService) {
        auth.handleAuthentication();
    }
}
Run Code Online (Sandbox Code Playgroud)

//auth.service.ts

import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import 'rxjs/add/operator/filter';
import auth0 from 'auth0-js';

@Injectable()
export class AuthService {

    auth0 = new auth0.WebAuth({
        clientID: …
Run Code Online (Sandbox Code Playgroud)

auth0 angular2-services angular

6
推荐指数
1
解决办法
573
查看次数

标签 统计

angular ×1

angular2-services ×1

auth0 ×1