Customer session
Refresh Customer token
Refreshes the Customer’s current token.
An error is returned when the Customer is not logged in or the token has expired and cannot be refreshed.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.refreshToken(onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.refreshToken(function(token) {
// success
}, function(error) {
// failure
});
Retrieve Customer token
Retrieves the Customer’s current, active token.
An error is returned when the Customer is not logged in or the token has expired and cannot be refreshed.
Declared In
lib/main/modules/ClientModule.js
Related
lib/classes/Token/Token.js
Method
Synerise.Client.retrieveToken(onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.retrieveToken(function(token) {
// success
}, function(error) {
// failure
});
Get current Customer UUID
Retrieve the Customer’s current UUID.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.getUUID()
Return Value
The method returns the Customer’s UUID as string.
Example
let uuid = Synerise.Client.getUUID();
Regenerate Customer
Regenerate the UUID and clear the authentication token, login session, custom email, and custom identifier.
This operation works only if the Customer is anonymous.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.regenerateUUID()
Return Value
true
if the Current Customer is anonymous and the operation succeed, false
otherwise.
Example
Synerise.Client.regenerateUUID();
Regenerate Customer with identifier
Regenerate the UUID and clear the authentication token, login session, custom email, and custom identifier.
This operation works only if the Customer is anonymous.
The optional clientIdentifier
parameter is a seed for UUID generation.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.regenerateUUIDWithClientIdentifier(clientIdentifier)
Return Value
true
if the current Customer is anonymous and the operation succeeds, false
otherwise.
Destroy current session
Destroys the whole session completely.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.destroySession()
Return Value
There is no return value.
Example
Synerise.Client.destroySession();