"passwordlessVerify" success is not returning anything

I am trying to use paswordlessVerify. My code is following:

 verifySMSCode(code, callback) {
      connection: 'sms',
      phoneNumber: "+88" + this.shareService.getPhoneNumber(),
      verificationCode: code
    }, function (err, res) {
         if (err.statusCode==400) {
        // Handle error
      } else{
            console.log("if no error, return true"+err.statusCode);
      // If successful, save the user's token and proceed
    return true   

Now if I give valid SMS code, it never goes to else block.
Please help.


It looks like you might be using an older version of Auth0.js. In the latest version 9, you should be using the webAuth.passwordlessStart and webAuth.passwordlessLogin methods to get an sms code and verify that code, respectively.

After initializing the webAuth object with:

var webAuth = new auth0.WebAuth({
  clientID: '{YOUR_CLIENT_ID}',
  domain: '{YOUR_AUTH0_DOMAIN}',
  redirectUri: 'http://example.com',
  responseType: 'token'

You can trigger an sms with:

    connection: 'sms',
    send: 'code',
    phoneNumber: '{PHONE NUMBER}'
  }, function (err,res) {
    // handle errors or continue

When the sms with the code is received, you’ll be able to verify it with:

    connection: 'sms',
    phoneNumber: '{PHONE NUMBER}',
    verificationCode: '{CODE}'
  }, function (err,res) {
    // handle errors or continue

You can read more about the passwordless login here:

1 Like

Thank you! Can you say how to disable redirect? Currently I am implementing a mobile app. After authentication, it opens browser. Is it possible to not redirect to browser?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.