Create user: phone_number madness

It’s not easy to understand … the phone number field …

The documentation says it optional

phone_number string (optional)
The user’s phone number (following the E.164 recommendation), only valid for users from SMS connections.

my tries:

#1 request

{
  "email": "adriana.will@yahoo.com",
  "phone_number": "",
  ...
  "connection": "Username-Password-Authentication",
  ...
}

Response

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

#2 request (without phone_number)

{
  "email": "adriana.will@yahoo.com",
...
}

Response

Payload validation error: 'Expected type string but found type null' on property phone_number (The user's phone number (following the E.164 recommendation), only valid for users from SMS connections)

#3 request

{
  "email": "adriana.will@yahoo.com",
  "phone_number": "+113407178302",
  ...
  "connection": "Username-Password-Authentication",
...
}

Response

\\\"phone_number\\\" is not allowed\",\"errorCode\":\"invalid_body\"

Anyone please ? What should I put ?

Hi @juan.garbora,

Welcome to the Auth0 Community!

I am able to successfully send this payload to a non-SMS connection:

{
  "email":"test@test.com",
  "connection":"Username-Password-Authentication",
  "password":"password"
}

Can you try that payload and let me know?

Thank you. That works !

Maybe you should update your API documentation with that body example.

1 Like

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