User Data Migration
Once your user accounts have been migrated over to SuperTokens, additional information like metadata, roles and permissions can be associated with the user.
User Metadata Migration
SuperTokens allows you to store arbitrary data that is JSON serializable against a userId.
In this example we want to store the following metadata against our user:
{
"someKey": "someValue"
}
curl --location --request PUT '<CORE_API_ENDPOINT>/recipe/user/metadata' \
--header 'api-key: <YOUR_API_KEY>' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{
"userId": "5acb2dbc-04f0-4c80-822a-7f06cd658f6f",
"metadataUpdate": {
"someKey": "someValue"
}
}'
User Roles Migration
SuperTokens allows you to assign roles and permissions to a userId.
In this example we will be assigning the admin
role to a user:
curl --location --request PUT '<CORE_API_ENDPOINT>/recipe/user/role' \
--header 'api-key: <YOUR_API_KEY>' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{
"role": "admin",
"userId": "5acb2dbc-04f0-4c80-822a-7f06cd658f6f"
}'
Important
Roles and permissions must be created before they can be assigned to a user. You can follow this guide on creating roles and permissions in SuperTokens.