Customer session


Refresh customer token


This method refreshes the customer’s current token.

This method requires customer authentication.

Note: Returns an error if the customer is not logged in or the token has expired and cannot be refreshed.

Declared In:
lib/modules/client/client_impl.dart

Class:
ClientImpl

Declaration:

Future<bool> refreshToken({required void Function() onSuccess, required void Function(SyneriseError) onError}) async {

Parameters:

Parameter Type Mandatory Default Description
onSuccess void yes - Function to be executed when the operation is completed successfully
onError SyneriseError yes - Function to be executed when the operation is completed with an error

Return Value:
true if the operation is successful, otherwise it throws an error.

Example:

await Synerise.client.refreshToken(onSuccess: () {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});

Retrieve customer token


This method retrieves the customer’s current, active token.

This method requires customer authentication.

Note: Returns an error if the customer is not logged in or the token has expired and cannot be refreshed.

Declared In:
lib/modules/client/client_impl.dart

Class:
ClientImpl

Declaration:

Future<Token> retrieveToken({required void Function(Token) onSuccess, required void Function(SyneriseError) onError}) async {

Parameters:

Parameter Type Mandatory Description
onSuccess void yes -
onError SyneriseError yes -

Return Value:
Token

Example:

await Synerise.client.retrieveToken(onSuccess: (Token token) {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});

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
        });

Regenerate customer


This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier.

Note: This operation works only if the customer is anonymous.

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.

The optional clientIdentifier parameter is a seed for UUID generation.

Note: This operation works only if the customer is anonymous.

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
Note: 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 void yes - Function to be executed when the operation is completed successfully
onError SyneriseError 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
});
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker