I am trying to create a user through the management API (https://auth0.com/docs/api/management/v2/#!/Users/post_users) which works fine. If I select “sms” as
connection, I must add a
phone_number to to request, and may also and an
However, if I select “email” as
phone_number is invalid. This strikes me as a little inconsistent. Would be very happy to get an explanation why this is.
Hey there @spaceben!
Happy to find it out! I’ll get back to you as soon as I manage to get some info on that!
Thanks. Anything already?
I didn’t find anything in our docs. I created an internal request for that for our engineering team. Waiting for their response.
That’s how the system is expected to behave.
When using https://auth0.com/docs/api/management/v2#!/Users/post_users API, three strategies can be used to create a user identifier:
- database connection that supports both email and username fields (if requires username enabled)
- passwordless sms connection that supports phone_number only
- passwordless email connection that supports email only
The email, username and phone_number in root user profile are identifiers and depending on the connection strategy we don’t allow some of the attributes.
If you want to add extra attributes like an email in a sms connection, you can use app_metadata and the phone_number can be added in the IdToken in a rule if needed.
Thank you for the answer. It is incorrect however. I generated the above output by calling the API with the passwordless sms connection strategy.
The point I am making is that one would not be able to produce the same output which only differs in the
identities array by choosing the passwordless email connection strategy.
Hmmmm… let me discuss those results again! Will get back to you shortly!
That’s expected as each connection strategy has different capabilities, even if they share the same API2 endpoint for user management.
phone_number is ONLY allowed in the root user profile when using SMS connection. It is not a simple change in the array.
I suggest you to add feedback here https://auth0.com/feedback so appropriate product manager can take a look at the request.