Skip to main content
Version: 1.0.0

syncUser

User testUser = new User.Builder(userKey)
.withEmail(userEmail)
.withFirstName(userFirstName)
.withLastName(userLastName)
.build();
user = permit.api.syncUser(testUser);

// SyncUser returns the synced with UserModel type
// {
// public String id = null;
// public String customId = null;
// public String firstName = null;
// public String lastName = null;
// public String email = null;
// public HashMap<String, String> attributes = null;
// public String organizationId = null;
// public ArrayList<String> tenantIds = null;
// }

This function is used to sync (save) a user's information to the Permit.io cloud (and PDP) upon user creation.

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.