User Management with Auth0.Swift
The Management API provides functionality that allows you to link and unlink separate user accounts from different providers, tying them to a single profile (Read more about Linking Accounts with Auth0). It also allows you to update user metadata.
Linking user accounts will allow a user to authenticate from any of their accounts and no matter which one they use, still pull up the same profile upon login. Auth0 treats all of these accounts as separate profiles by default, so if you wish a user's accounts to be linked, this is the way to go.
link method accepts two parameters, the primary user id and the secondary user token (the token obtained after login with this identity). The user id in question is the unique identifier for this user account. If the id is in the format
facebook|1234567890, the id required is the portion after the delimiting pipe.
Unlinking users is a similar provess to the linking of users. The
unlink method takes three parameters, though: the secondary user id, and the secondary provider (the provider of the secondary user), and the primary user id.
The parameters read, essentially: "Unlink this secondary user (with this provider) from this primary user".
IdP-initiated Single Sign-on
Retrieving user metadata
Update user metadata
When updating user metadata, you will create a
userMetadata object, and then call the
patch method, passing it the user id and the
userMetadata object. The values in this object will overwrite existing values with the same key, or add new ones for those that don't yet exist in the user metadata.