Customer session

Get Customer token


Get a valid and refreshed JWT login token. An error is thrown when the Customer is not logged in or the token has expired and cannot be refreshed.

The method returns IDataApiCall with a parameterized Token to execute request.

Method name: Client.getToken()

Declaration

public static IDataApiCall<Token> getToken()

Parameters

No parameters required.

Return Value

IDataApiCall object to execute the request.

Example

IDataApiCall getTokenCall = Client.getToken();
        getTokenCall.execute(success -> onSuccess(), this::onFailure);

Get current UUID of a Customer


Retrieve current Customer 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()

Regenerate UUID for an anonymous Customer


Regenerate UUID and clear the authentication token, login session, custom email, and custom identifier.

This operation works only if the current Customer is anonymous.

The method returns true when the current Customer is anonymous and the operation was successful.

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

Generate UUID for anonymous Customer with identifier

Gegenerate/re-generate UUID and clear the authentication token, login session, custom email, and custom identifier.

The UUID is generated from the Customer identifier and the device ID. A combination of those two IDs always generates the same UUID, regardless of how many times the method is called for the combination.

Method name: Client.regenerateUuid(clientIdentifier)

Declaration

public static boolean regenerateUuid(clientIdentifier)

Parameters

Parameter Type Mandatory Default
clientIdentifier String yes -

Return Value

Returns true if the current Client is anonymous and the operation succeeds.

Example

boolean success = Client.regenerateUuid(clientIdentifier);

Change API Key dynamically


Change the API Key dynamically. If the currently saved API Key is different than provided, the authentication token will be cleared.

The Customer’s UUID, login session, custom email, and custom identifier will always be cleared.

Method name: Client.changeApiKey(newApiKey)

Declaration

public static void changeApiKey(@NonNull String newApiKey)

Parameters

Parameter Type Mandatory Default Description
newApiKey String yes - New API Key

Return Value

Void type method.

Example

Client.changeApiKey(apiKey);

Destroy customer’s session


Use this method to destroy a session. All cached data is cleared and a new anonymous customer is created.

Method name: Client.destroySession()

Declaration

public static void destroySession()

Parameters

No parameters required.

Return Value

Method is void type.

Example

Client.destroySession();
😕

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.