我正在使用无密码短信验证创建自定义的auth0登录名。我已经使用锁小部件运行它了,但是需要有一个自定义的版本。在测试发送短信时,我收到此错误:
IdentitynopromptComponent.html:72错误错误:cb参数不是 有效 在变量处(auth0.min.esm.js:8) 在Object.check(auth0.min.esm.js:8) 在PasswordlessAuthentication.push ../ node_modules / auth0-js / dist / auth0.min.esm.js.PasswordlessAuthentication.start中 (auth0.min.esm.js:8) 在WebAuth.push ../ node_modules / auth0-js / dist / auth0.min.esm.js.WebAuth.passwordlessStart处 (auth0.min.esm.js:8) 在CustomAuth0Service.push ../ src / app / services / auth0 / custom-auth0.service.ts.CustomAuth0Service.sendSMS (custom-auth0.service.ts:39) 在IdentitynopromptComponent.push ../ src / app / components / identitynoprompt / identitynoprompt.component.ts.IdentitynopromptComponent.sendSMSRequest中 (identitynoprompt.component.ts:44) 在Object.eval [作为handleEvent](IdentitynopromptComponent.html:72) 在handleEvent(core.js:10258) 在callWithDebugContext(core.js:11351) 在Object.debugHandleEvent [作为handleEvent](core.js:11054)
我已签入auth0 docs,并认为我输入了正确的回调参数,我还缺少什么? 这是6号角代码:
import { DataModel } from './../../models/data-model';
import { EventHub } from './../../models/hub/event-hub';
import { Observable, throwError } from 'rxjs';
import { environment } from '../../../environments/environment';
import { AwsService, Callback } from './../aws/aws.service';
import { Injectable, Output, EventEmitter, Input } from '@angular/core';;
import { Router } from '@angular/router';
import * as auth0 from 'auth0-js';
@Injectable({
providedIn: 'root'
})
export class CustomAuth0Service {
private _awsService: AwsService;
private _eventhub: EventHub;
private dataModel: DataModel;
webAuth = new auth0.WebAuth({
domain: environment.auth0config.domain,
clientID: environment.auth0config.clientID,
responseType: 'code',
responseMode: 'code',
redirectUri: 'http://localhost:4200/catlist',
audience: environment.auth0config.audience,
scope: 'openid'
});
constructor(public router: Router, aws: AwsService, model: DataModel) {
this.dataModel = model;
this._awsService = aws;
}
// https://auth0.com/docs/libraries/auth0js/v9 -- Start passwordless
public sendSMS(phonenumber: string): void {
console.log('phonemunber to send => ', phonenumber);
const prefix = environment.auth0config.phone_prefix;
this.webAuth.passwordlessStart({
phoneNumber: prefix + phonenumber,
connection: 'sms',
send: 'code',
});
}