Skip to main content

Update app user identifier

You can update the app user identifier you had used to register the app user. In most app flows, this is a method that's rarely called.

For example, suppose that you have registered your app user with an email. The app user would be able to subsequently change their email in app settings and still continue using your service as the same entity.

Calling Shake.updateUserId on an already registered app user:

  1. Updates the app user identifier in the Shake database.
  2. It becomes the new app user identifier.
  3. You continue to pass this new app user identifier to Shake.registerUser on this app user's subsequent logins.
caution

Updating the app user identifier allows various possibilities for how this feature can be used but can also lead to possibly unwanted results. Read the documentation carefully to fully understand possible usages and scenarios.

The code snippet below showcases a common scenario in which the app user identifier is updated. It's assumed that the app user was previously registered with an email:

App.js
const changeEmail = email => {
networkService.updateUserEmail(email,
user => {
Shake.updateUserId(user.email);
handleEmailChange(user);
},
message => {
// Handle failed update
});
}