Customer session
Refresh customer token
This method refreshes the customer’s current token.
This method requires customer authentication.
Method name:
Client.refreshToken()
Declaration:
public static IApiCall refreshToken()
Parameters:
No parameters required.
Return Value:
IApiCall object to execute the request.
Example:
boolean success = Client.refreshToken();
Retrieve customer token
This method retrieves the customer’s current, active token.
This method requires customer authentication.
Method name:
Client.getToken()
Declaration:
public static IDataApiCall<Token> getToken()
Parameters:
No parameters required.
Return Value:
IDataApiCall<Token> object to execute the request.
Example:
IDataApiCall getTokenCall = Client.getToken();
getTokenCall.execute(success -> onSuccess(), this::onFailure);
Get current customer UUID
This method retrieves the customer’s current UUID.
Method name:
Client.getUuid()
Declaration:
public static String getUuid()
Parameters:
No parameters required.
Return Value:
Customer’s UUID as a string.
Example:
Client.getUuid()
Get customer UUID for use in authentication
Retrieves the current UUID or generates a new one from a seed.
Method name:
Client.getUuidForAuthentication()
Declaration:
public static String getUuidForAuthentication(@NonNull String authId)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
authId | String | yes | — | Seed for UUID generation |
Return Value:
The UUID for use in authentication as a string.
Example:
Client.getUuidForAuthentication(authId)
Regenerate customer
This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier.
Method name:
Client.regenerateUuid()
Declaration:
public static boolean regenerateUuid()
Parameters:
No parameters required.
Return Value:
Returns true if the current Customer is anonymous and the operation succeeds.
Example:
boolean success = 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.
Method name:
Client.regenerateUuid(clientIdentifier)
Declaration:
public static boolean regenerateUuid(clientIdentifier)
Parameters:
Parameter | Type | Mandatory | Description |
---|---|---|---|
clientIdentifier | String | no | Seed for UUID generation |
Return Value:
Returns true if the current Client is anonymous and the operation succeeds.
Example:
boolean success = Client.regenerateUuid(clientIdentifier);
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.
Method name:
Client.destroySession()
Declaration:
public static void destroySession()
Parameters:
No parameters required.
Return Value:
Method is void type.
Example:
Client.destroySession();