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 MigrationSuperTokens allows you to store arbitary 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 '/recipe/user/metadata' \--header 'api-key: ' \--header 'Content-Type: application/json' \--data-raw '{ "userId": "5acb2dbc-04f0-4c80-822a-7f06cd658f6f", "metadataUpdate": { "someKey": "someValue" }}'
#
User Roles MigrationSuperTokens 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 '/recipe/user/role' \--header 'api-key: ' \--header 'Content-Type: application/json' \--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.