It’s not easy to understand this API … phone number field …
The documentation says it's 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",
"connection": "Username-Password-Authentication",
...
}
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
Anyone please ? What should I put ?
I had the same issue. Auth0 support told me the following:
"This will occur if the connection in question does not have the phone_number attribute enabled in Authentication > Database > {DB connection} > Attributes tab (Docs)
*You would have to enable the attribute and add phone_number as an optional identifier. This will enable the phone_number attribute to be used with the POST request. If you don't have a phone_number then you can just omit the property from the POST and the user will be created without a phone. "
*
This will only work with Universal Login. If you use Classic login you can't save the phone_number
Edit: more info from auth0
"the only way to add the phone number with Classic Login is to add the phone number to the user's user_metadata section"