Create user with phone field to use sms

Hello,

But I’m having trouble registering the phone and the following error appears

How should I register the phone, as I will need it to use SMS

Ex:
“phone_number”: “+441234567890”,
“phone_verified”: false,

or I also need to set

“identities”: [
{
“connection”: “sms”,
“user_id”: “…”,
“provider”: “sms”,
“isSocial”: false
}
],

“message”: “Payload validation error: ‘String does not match pattern ^+[0-9]{1,15}$: 5511934712378’ on property phone_number (The user’s phone number (following the E.164 recommendation), only valid for users from SMS connections).”,
“errorCode”: “invalid_body”

It looks like you are missing a + in your phone number.

with + give this error

phone_number: +5511934712378
phone_verified: false

{
“statusCode”: 400,
“error”: “Bad Request”,
“message”: ““phone_number” is not allowed”,
“errorCode”: “invalid_body”
}

Typically you get this error when you are trying to add a phone_number root attribute to a non-sms connection.

please give me the correct way to do this.

Can you explain what you are trying to do?

  • Create a new passwordless sms user?
  • Add MFA?
  • Record phone # for another reason outside of auth0?
  • Other?

I need to create a user via https://auth0.com/docs/api/management/v2?_ga=2.20550520.1593318340.1591617099-2124757984.1589198186#!/Users/post_users

when adding the phone of the error that has already been reported.
because after using the phone number, authenticate via SMS

See how to print via mail, with the fields I’m sending
https://uploaddeimagens.com.br/imagens/taUKl8E

You cannot add a phone_number root attribute to a username/password connection. You need to create a user with "connection":"sms" to make it possible to authenticate via phone number OR create a user with email/password.

You can use account linking to connect the two accounts in different connections:

like that, Create user from Management API with phone_number and email

Ex
“identities”: [
{
“connection”: “sms”,
“user_id”: “…”,
“provider”: “sms”,
“isSocial”: false
}
],
“name”: “+441234567890”,
“nickname”: “my_nickname”,
“phone_number”: “+441234567890”,
“phone_verified”: false,

In the screenshot you provided you are creating a user with connection:Username-Password-Connection

now gave this error.

Wow! when it is difficult to create a user with a phone, to validate with SMS.

doubt: can the user login with Username-Password-Authentication and sms?

{
“statusCode”: 400,
“error”: “Bad Request”,
“message”: “The connection does not exist.”,
“errorCode”: “inexistent_connection”
}

If you would like to set up sms authentication it can be done fairly simply by following our docs:

No. As I stated above, you will need two seperate users, one user for sms, one user for username and password, and you must link their accounts using account linking.

You are trying to add a user to a connection that you have not created.

waiting for a solution

Hello,

1-
I am not understanding how to add the phone in user creation.

can pass an example using Postman

2-
I have registered users with connection Username-Password-Authentication.

How to authenticate these users by sms?

You cannot authenticate from a Username-Password-Authentication connection with sms.

You must set up an sms connection using this paswordless authentication.

1 Like

I will try to follow the doc, but will each of my users have their sms authentication?

What is the difference of the doc that passed to this (Multi-factor Authentication - SMS) https://manage.auth0.com/dashboard/us/dev-taw5nu25/mfa

Here the system user, I was unable to login using the code sent by SMS

As the explanation is not clear for user login via SMS code and just send me the doc, I’m sure I know what I’m doing and will give the expected result.

Multifactor Authentication is a second factor. It works like this:

  • the user logs in via username and password
  • in addition, they must use an sms code to fully authenticate.

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