addProfile

Replaces the security profile associated with the user.

Updating a user will have no impact until the [`create`](/sdk/js/5/core-classes/user/create) or [`replace`](/sdk/js/5/core-classes/user/replace) method is called

addProfile(profileId)

Arguments Type Description
profileId string Profile ID

addProfile(profile)

Arguments Type Description
profile Profile An instantiated Profile object

Return Value

Returns the User object.

Usage

Copied to clipboard!
var profile = kuzzle.security.fetchProfile('myprofile', function(error, profile) {
  // Can add a profile directly with a Profile object
  user.addProfile(profile);
});

// Or by passing an id
user.addProfile('myprofile');