syncUser
const userData: IPermitUser = {
key: user.id,
firstName: user.firstName,
lastName: user.lastName,
email: user.email,
roles: [
{
role: "admin",
tenant: board.id,
},
],
};
await permit.write(permit.api.syncUser(userData));
// SyncUser returns the synced with UserKey type
// {
// "customId": string,
// "email": string,
// "firstName": string,
// "lastName": string,
// "attributes": Dictionary<string, string>,
// }
This function is used to sync (save) a user's information to the Permit.io cloud (and PDP) upon user creation.
The function should be used for the initial creation of the user;
note
The function should be used for the initial creation of the user. Once the user has been synced with Permit, you should not use this API call anymore to update the user's role.
Instead use: Assign role SDK function to update user roles. You can use the Permit web application user management or policy editor to update user data. You can also use the rest API.