【发布时间】:2021-12-05 02:05:56
【问题描述】:
致力于身份验证的 Aungluar 新手。我将 auth0-angular 包下载到我的项目中,现在我在创建 WebAuth() 实例时遇到此错误(IDE:VS Code):
" 属性 'WebAuth' 不存在于类型 'typeof import("c:/Users/Owner/Desktop/coding_course_docs/AngularAudioPlayer/node_modules/@auth0/auth0-angular/auth0-auth0-angular")' "
这是我的代码:
import { Injectable } from '@angular/core';
import * as auth0 from '@auth0/auth0-angular';
import { environment } from '../../environments/environment';
import{
Observable,
BehaviorSubject,
bindNodeCallback,
of
} from 'rxjs';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class AuthService {
//instance of auth0-WebAuth that is used for authentication
auth0 = new auth0.WebAuth({
clientID: environment.auth0.clientID,
domain: environment.auth0.domain,
responseType: 'token id_token',
scope: 'openid profile email'
});
//'localStorage' keys (for storing authentication and user profile data) that track whether or not to renew token
private _authFlag = 'isLoggedIn';
private _userProfileFlag = 'userProfile';
对我做错了什么有任何想法吗?
【问题讨论】:
标签: angular import auth0 webauthn