auth0 / auth0-java

Java client library for the Auth0 platform
https://auth0.com
MIT License
287 stars 131 forks source link

Add support for `/users/{user_id}/authenticators` endpoint to retrieve all Guardian Enrollments #472

Closed jdk2pq closed 1 year ago

jdk2pq commented 1 year ago

Describe the problem you'd like to have solved

Our use case is that we would like to retrieve the phone number stored for a user on Auth0. Since we require mobile MFA (with email MFA as a fallback), we should be able to get this number from the Guardian Enrollments. However, the /users/{user_id}/enrollments endpoint only returns the first confirmed enrollment in the user's list of MFA enrollments, and for users who use a social sign-on provider (e.g. Google), the first enrollment in the list is their verified email address, so this endpoint will not work for getting those users' phone numbers.

In the Auth0 Community's FAQ's, there is a solution that uses the /users/{user_id}/authenticators endpoint described here, here, and finally here. That will return the full list of enrollments for a user and allow us to filter down to just the SMS/Voice enrollments to get the user's phone number.

Describe the ideal solution

A new method is added to UsersEntity.java that calls the /users/{user_id}/authenticators endpoint and returns the full list of authenticators for the user.

Alternatives and current work-arounds

Currently, we call the endpoint in our own code outside of the auth0-java SDK.

Additional information, if any

jimmyjames commented 1 year ago

:wave: Hey @jdk2pq, thanks for all the info and context.

I know this may sound pedantic, but our SDKs will support endpoints once they are fully supported and documented. Given that the /users/{user_id}/authenticators endpoint is not publicly documented yet, we will not be adding it to this library. I recognize given some of the community responses it may be OK to use, but until it is officially released and documented, our SDKs will not implement it. Hope you understand, thanks!