Session management
UUID regeneration mechanism
The UUID is regenerated when:
-
the application is reinstalled and UUID cannot be recovered
-
one of the UUID regeneration methods is invoked:
-
the destroy session method is invoked - Destroy customer session
-
the SDK is reinitialized by changing the Profile API Key with one of these methods:
- Change Profile API Key dynamically for Android SDK
- Change Profile API Key dynamically for iOS SDK
- Change Profile API Key dynamically for React Native SDK
- Change Profile API Key dynamically for Flutter SDK
-
the customer is authenticated by Simple Authentication with your own UUID set
-
the customer is authenticated by one of the following options and the authId/authID parameter is used:
- Simple Authentication
- Registration as a Service
- OAuth
- External Providers
Important: the authId/authID parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer)
-
the customer is signed out with SESSION_DESTROY mode
-
the customer is removed by the removal methods
Session management methods
Refresh customer token
This method refreshes the customer’s current token.
OS | Method |
---|---|
Android | Client.refreshToken() |
iOS | Client.refreshToken() |
React Native | Synerise.Client.refreshToken() |
Flutter | Synerise.client.refreshToken() |
Retrieve customer token
This method retrieves the customer’s current, active token. Authentication required.
OS | Method |
---|---|
Android | Client.getToken() |
iOS | Client.retrieveToken() |
React Native | Synerise.Client.retrieveToken() |
Flutter | Synerise.client.retrieveToken() |
Get current customer UUID
This method retrieves the customer’s current UUID.
OS | Method |
---|---|
Android | Client.getUuid() |
iOS | Client.getUUID() |
React Native | Synerise.Client.getUUID() |
Flutter | Synerise.client.getUUID() |
Regenerate customer
This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier. This operation works only if the customer is anonymous.
OS | Method |
---|---|
Android | Client.regenerateUuid() |
iOS | Client.regenerateUUID() |
React Native | Synerise.Client.regenerateUUID() |
Flutter | Synerise.client.regenerateUUID() |
Regenerate customer with identifier
This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier. The optional clientIdentifier parameter is a seed for UUID generation.
OS | Method |
---|---|
Android | Client.regenerateUuid(clientIdentifier) |
iOS | Client.regenerateUUID |
React Native | Synerise.Client.regenerateUUIDWithClientIdentifier() |
Flutter | n/a |
Destroy customer session
This method destroys the whole session completely.
OS | Method |
---|---|
Android | Client.destroySession() |
iOS | Client.destroySession() |
React Native | Synerise.Client.destroySession() |
Flutter | Synerise.client.destroySession() |