Refresh customer token
This method refreshes the customer’s current token.
Returns an error if the token has expired and cannot be refreshed.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> refreshToken({required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.client.refreshToken(onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<bool> refreshToken() async
Return Value:
true if the operation is success, otherwise it throws an error.
Example:
await Synerise.client.refreshToken().catchError((error)
Retrieve customer token
This method retrieves the customer’s current, active token.
Returns an error if the token has expired and cannot be retrieved.
Declared In:
lib/modules/client/client_impl.dart
Related To:
Token
Class:
ClientImpl
Declaration:
Future<void> retrieveToken({required void Function(Token) onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| onSuccess | Function(Token token) | yes | - |
| onError | Function(SyneriseError error) | yes | - |
Return Value:
No value is returned.
Example:
await Synerise.client.retrieveToken(onSuccess: (Token token) {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<Token> retrieveToken() async
Return Value:
Token
Example:
Token token = await Synerise.client.retrieveToken().catchError((error)
Get current customer UUID
This method retrieves the customer’s current UUID.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<String> getUUID() async
Return Value:
String
Example:
await Synerise.client
.getUUID()
.then((result) => {
//result handling
});
Declaration:
Future<String> getUUID() async
Return Value:
String
Example:
String uuid = await Synerise.client.getUUID().catchError((error)
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.
This operation clears the authentication token, login (if applicable), custom email, and custom identifier.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 3.3.10 | 3.3.5 | 0.9.0 | 0.7.0 |
| Declared In: | ||||
| lib/modules/client/client_impl.dart |
Class:
ClientImpl
Declaration:
Future<void> regenerateUUID() async
Return Value:
No value is returned.
Example:
await Synerise.client
.regenerateUUID()
.then((result) => {
//result handling
});
Regenerate customer with identifier
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.
This operation clears the authentication token, login (if applicable), custom email, and custom identifier
The optional clientIdentifier parameter is a seed for UUID generation.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 3.6.5 | 3.6.4 | 0.9.10 | 0.7.2 |
| Declared In: | ||||
| lib/modules/client/client_impl.dart |
Class:
ClientImpl
Declaration:
Future<void> regenerateUUIDWithClientIdentifier(String clientIdentifier) async
Parameters:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| clientIdentifier | String | no | Seed for UUID generation |
The clientIdentifier parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer.
Return Value:
No value is returned.
Example:
await Synerise.client
.regenerateUUIDWithClientIdentifier(clientIdentifier)
.then((result) => {
//result handling
});
Destroy current session
This method destroys the session completely.
This method clears all session data (both client and anonymous) and removes cached data. Then, it regenerates the UUID and creates the new anonymous session.
Declared In:
lib/modules/client/client_impl.dart
Class:
ClientImpl
Declaration:
Future<void> destroySession({required void Function() onSuccess, required void Function(SyneriseError) onError}) async
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
| onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
await Synerise.client.destroySession(onSuccess: () {
//onSuccess handling
}, onError: (SyneriseError error) {
//onError handling
});
Declaration:
Future<void> destroySession() async
Return Value:
No value is returned.
Example:
await Synerise.client.destroySession().catchError((error)