Auth0 Home Blog Docs

ERROR: cb parameter is not valid - Passwordless SMS

auth0
api
login

#1

I 'm creating a customised auth0 login using passwordless sms verification. I already have it running using the lock widget but need to have a customised version. While testing sending an sms I receive this error: IdentitynopromptComponent.html:72 ERROR Error: cb parameter is not valid at variable (auth0.min.esm.js:8) at Object.check (auth0.min.esm.js:8) at PasswordlessAuthentication.push../node_modules/auth0-js/dist/auth0.min.esm.js.PasswordlessAuthentication.start (auth0.min.esm.js:8) at WebAuth.push../node_modules/auth0-js/dist/auth0.min.esm.js.WebAuth.passwordlessStart (auth0.min.esm.js:8) at CustomAuth0Service.push../src/app/services/auth0/custom-auth0.service.ts.CustomAuth0Service.sendSMS (custom-auth0.service.ts:39) at IdentitynopromptComponent.push../src/app/components/identitynoprompt/identitynoprompt.component.ts.IdentitynopromptComponent.sendSMSRequest (identitynoprompt.component.ts:44) at Object.eval [as handleEvent] (IdentitynopromptComponent.html:72) at handleEvent (core.js:10258) at callWithDebugContext (core.js:11351) at Object.debugHandleEvent [as handleEvent] (core.js:11054)

I’ve checked in the auth0 docs at https://auth0.com/docs/libraries/auth0js/v9 and think I’ve entered the correct callback parameter, what am I missing?

Angular 6 code:

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’,
});
}