auth0 / Auth0.Android

Android toolkit for Auth0 API
https://auth0.com
MIT License
208 stars 130 forks source link

createUser func to support setting given_name and family_name #725

Closed emmaLP closed 3 months ago

emmaLP commented 3 months ago

Checklist

Describe the problem you'd like to have solved

The current SDK functionality does not allow the setting of given_name and family_name when calling the signup func. We are using native login and leveraging the SDK handle logins and signups.

According to the signup API Docs, the API endpoint supports submitting given_name and family_name.

When we have a user sign up for an account via our iOS integration, the user's given_name and family_name are having to be stored in user_metadata which doesn't allow the values to be set on the Auth0 profile and the name shown in the Auth0 dashboard is just the email address.

Describe the ideal solution

Provide the ability to set the given_name and family_name as optional fields on user signup

https://github.com/auth0/Auth0.Android/blob/48d936476eba1645d0c9130ed5ae5a90e844369a/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt#L409

Alternatives and current workarounds

We have tried to use a post-login as well as a post-user-registration action to take the user_metadata values and make a management api call to update the user's details profile. However we have additional actions on post login that require the the user's given_name and family_name to be set in order to send this data to downstream systems.

Additional context

Allow this function to have 2 more optional fields

emmaLP commented 3 months ago

You can use the addParameter("key", "value") method before calling start() method

Example:

val request = apiClient.createUser(
            email = email,
            password = password,
            username = null,
            connection = AUTH0_DATABASE,
            userMetadata = meta
        ).addParameter("given_name", firstName)
            .addParameter("family_name", lastName)
            .addParameter("name", "$firstName $lastName")