User Creation and Management
For the SDK to perform detections and deliver valuable insights, a Sentiance user must first be created.
Each Sentiance user is linked to a unique user in your system. When creating a Sentiance user, you must provide an identifier that uniquely represents the user on your side.
This linking requires a server-to-server interaction. The Sentiance SDK does not accept your system’s user identifier directly from your app, as a mobile app is not considered a trusted source. Instead, your backend must send the unique user identifier to Sentiance, authenticated using a Sentiance API key.
If the provided unique user identifier is already linked to an existing Sentiance user, that user is restored on the device. Otherwise, a new Sentiance user is created.
User Creation flow
You provide to us your unique user identifier when making an authentication code request. In return, Sentiance will provide to you a short-lived authentication code, which you will then use to create a Sentiance user on the device.
The steps are as follows:
When decided to create a Sentiance user, contact your backend and request a Sentiance authentication code.
On your backend, create a corresponding request towards the Sentiance backend, which will include your user's unique identifier. This request is authenticated using a Sentiance API Key.
Retrieve the authentication code provided by Sentiance and forward it to your app.
In the app, create a Sentiance user by passing this authentication code.
Check out User Creation for detailed instructions
Multi-Device support
A Sentiance user can only be active on one device at a time.
If a user is already authenticated on one device and authenticates on another, the new device takes priority, and the user will be deactivated on the previous device.
The only exception to this is when the existing active user instance is on a mobile phone, and you attempt to restore the user on a tablet device. In this case, Sentiance will prioritize the mobile phone , and keep the user active.
When a user is deactivated:
The SDK stops performing detections
The user must re-authenticate before detections can resume
User Deletion
From the Device
To remove all SDK data and user-related information from a device, call the reset() method on the SDK’s core instance.
This will remove:
Stored SDK data
Settings and configurations
Detection data
All user-related data on the device
Important Notes
During an ongoing reset operation, other SDK method calls may be ignored, fail, or return default values.
Make sure the app stays in the foreground while the reset is in progress, for example by keeping an activity open or a foreground service running. If the app is backgrounded or terminated, the SDK cannot guarantee that the reset will complete successfully.
The
reset()method can be called even if the SDK has not been initialized.
From the Sentiance Platform
Deleting a user from the Sentiance platform must be done via server-to-server communication.
User Deletion can be achieved by using the delete_user mutation. An API Key with the USER_DELETE scope must be used to call the deletion mutation.
When initiating a deletion request, a request_id is returned in the response. This ID is intended for debugging purposes only and can be shared with Sentiance support if needed.
After the deletion request has been successfully completed, you should reset the SDK on the user’s device. Resetting the SDK will:
Stop all SDK operations
Remove all user-related data from the device
Last updated