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:
Headers/SNRClient.h

Class:
Client

Declaration:

static func refreshToken(success: (() -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters:

Parameter Type Mandatory Default Description
success (() -> Void) yes - Closure/Block to be executed when the operation is completed successfully
failure ((ApiError) -> Void) yes - Closure/Block to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Client.refreshToken(success: { _ in
	Client.retrieveToken(success: { (token) in
	  // success
		let tokenString: String = token.tokenString
		let tokenOrigin: TokenOrigin = token.tokenOrigin
	}, failure: { (error) in
	  // failure
	})
}, failure: { (error) in
  // failure
})

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:
Headers/SNRClient.h

Related To:
Token

Class:
Client

Declaration:

static func retrieveToken(success: ((Token) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters:
| Parameter | Type | Mandatory | Default | Description | | success | ((Token) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully | | failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |

Return Value:
No value is returned.

Example:

Client.retrieveToken(success: { (token) in
  // success
	let tokenString: String = token.tokenString
	let tokenOrigin: TokenOrigin = token.tokenOrigin
}, failure: { (error) in
  // failure
})

Get current customer UUID


This method retrieves the customer’s current UUID.

Declared In:
Headers/SNRClient.h

Class:
Client

Declaration:

static func getUUID() -> String

Return Value:
The method returns the customer’s UUID as string.

Example:

let clientUUID: String = Client.getUUID()

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.

Declared In:
Headers/SNRClient.h

Class:
Client

Declaration:

static func regenerateUUID() -> Void

Return Value:
No value is returned.

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:
Headers/SNRClient.h

Class:
Client

Declaration:

static func regenerateUUID(clientIdentifier: String?) -> Void

Parameters:

Parameter Type Mandatory Default 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.

Destroy current session


This method destroys the whole session completely.

Declared In:
Headers/SNRClient.h

Class:
Client

Declaration:

static func destroySession()

Return Value:
No value is returned.

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.

Close modal icon Placeholder alt for modal to satisfy link checker