gpt4 book ai didi

node.js - Auth0 与 Angular2 "Supplied parameters do not match any signature of call target."

转载 作者:太空宇宙 更新时间:2023-11-04 00:20:59 27 4
gpt4 key购买 nike

我目前正在尝试使用我的 Angular2 应用程序设置 Auth0。我正在使用 angular2-cli。我添加了一个名为 auth 的新服务。当我运行 npm start 时,出现错误 src/app/auth.service.ts (21,5): Suppliedparameters do not match any signature of call target.

这是我的 auth.service.ts

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

@Injectable()
export class AuthService {

auth0 = new auth0.WebAuth({
clientID: 'removed for privacy',
domain: 'removed for privacy',
responseType: 'token id_token',
audience: 'removed for privacy',
redirectUri: 'http://localhost:4200/callback',
scope: 'openid'
});

constructor(public router: Router) {}

public login(): void {
this.auth0.authorize();
}

}

这是我的 package.json 的依赖项

  "dependencies": {
"@angular/cli": "^1.0.0-rc.0",
"@angular/common": "^2.4.0",
"@angular/compiler": "^2.4.0",
"@angular/core": "^2.4.8",
"@angular/forms": "^2.4.0",
"@angular/http": "^2.4.0",
"@angular/platform-browser": "^2.4.0",
"@angular/platform-browser-dynamic": "^2.4.0",
"@angular/router": "^3.4.0",
"@angular2-material/button": "^2.0.0-alpha.5",
"@angular2-material/card": "^2.0.0-alpha.5",
"@angular2-material/checkbox": "^2.0.0-alpha.5",
"@angular2-material/core": "^2.0.0-alpha.5",
"@angular2-material/icon": "^2.0.0-alpha.5",
"@angular2-material/input": "^2.0.0-alpha.5",
"@angular2-material/list": "^2.0.0-alpha.5",
"@angular2-material/toolbar": "^2.0.0-alpha.5",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"pg": "^6.2.3",
"pg-hstore": "^2.3.2",
"rxjs": "^5.1.0",
"sequelize": "^3.30.4",
"sequelize-cli": "^2.7.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/cli": "1.0.0-rc.0",
"@angular/compiler-cli": "^2.4.0",
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"gh-pages": "^0.12.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"typescript": "~2.0.0",
"video.js": "^5.19.2"
}

我正在 Auth0 网站上关注 Auth0 Angular2 + SDK 快速入门,但运气不佳。任何帮助将不胜感激。

最佳答案

检查 auth0-js 库的 API here .

authorize 函数采用一个对象参数。

auth0.authorize({
audience: 'https://mystore.com/api/v2',
scope: 'read:order write:order',
responseType: 'token',
redirectUri: 'https://example.com/auth/callback'
});
<小时/>

login 函数中的以下函数引发错误。

this.auth0.authorize();

关于node.js - Auth0 与 Angular2 "Supplied parameters do not match any signature of call target.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44580759/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com