How to Update the User Profile Details of the Linked Accounts

Problem statement:

Auth0 supports the linking of user accounts from various identity providers. This allows a user to authenticate from any of their accounts and still be recognized by your app and associated with the same user profile.

How can we update the User profile details, such as password, for either the primary or the secondary account?

Solution:

To do this we need to make a call to PATCH โ€˜/api/v2/users/{primary account id}โ€™ endpoint, and in this connection we need to specify the connection type to identify if the change is for the Primary or the Secondary account.

For example, if the primary is google-oauth2, and the secondary is Username-Password-Authentication,

To update the password of the username password connection, this is the body script:

{
"connection": "Username-Password-Authentication",
"password": "Passw0rd!"
}

We can not update the password of the primary account which is linked to the google auth because users signing in with social connection must reset password in the social connection. Please refer to this doc.

However, if we want to update other profile details for the google-oauth2 connection such as user_metadata, here is the sample script.

{
"connection": "google-oauth2",
  "user_metadata": {
      "region":"xxx"
  }
}

Reference:

1 Like