Skip to main content

UserId Mapping

UserId Mapping allows you to map existing userIds (from your old auth provider) to the SuperTokens userIds. This prevents you from having to update the existing userIDs in your application's table.

As an example, if after creating the user in SuperTokens, their userId is fa7a0841-b533-4478-95533-0fde890c3483 and the existing userId for that user is customUserId, then you can map these user IDs by calling the following API:


curl --location --request POST '/recipe/userid/map' \
--header 'api-key: ' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{
"superTokensUserId": "fa7a0841-b533-4478-95533-0fde890c3483",
"externalUserId": "customUserId"
}'

Now whenever this user signs in, or if you fetch information about this user from SuperTokens, their userID will be customUserId.

note

The maximum allowed size of the externalUserId is 128 characters.

Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI