
---
## Refresh customer token
---
This method refreshes the customer’s current token.
  

<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Returns an error if the token has expired and cannot be refreshed.

</div></div></div>

**Declared In:**  
lib/modules/client/client_impl.dart
  
**Class:**  
[ClientImpl](/developers/mobile-sdk/class-reference/flutter/modules#client)


<div class="content-tabs" data-tab-group="tabgrp-921">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-921-0" data-tab-group="tabgrp-921" data-tab-active="true">SDK &gt;= 1.0.0</button><button class="tab-button" data-tab-id="tabgrp-921-1" data-tab-group="tabgrp-921">Legacy SDK</button></div>

<div class="tab-panel" data-tab-id="tabgrp-921-0" data-tab-group="tabgrp-921" data-tab-active="true">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;void&gt; refreshToken({required void Function() onSuccess, required void Function(SyneriseError) onError}) async</code></pre>


**Parameters:**  
| Parameter | Type | Mandatory | Default | Description |
| --- | --- | --- | --- | --- |
| **onSuccess** | Function() | yes | - | Function to be executed when the operation is completed successfully |
| **onError** | Function([SyneriseError](/developers/mobile-sdk/class-reference/flutter/miscellaneous#syneriseerror) error) | yes | - | Function to be executed when the operation is completed with an error |
  
**Return Value:**  
No value is returned.
  
**Example:**  

<pre><code class="language-Dart">await Synerise.client.refreshToken(onSuccess: () {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});</code></pre>

</div>

<div class="tab-panel" data-tab-id="tabgrp-921-1" data-tab-group="tabgrp-921">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;bool&gt; refreshToken() async</code></pre>

  
**Return Value:**  
**true** if the operation is success, otherwise it throws an error.
  
**Example:**  

<pre><code class="language-Dart">await  Synerise.client.refreshToken().catchError((error)</code></pre>

</div>
</div>


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

<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Returns an error if the token has expired and cannot be retrieved.

</div></div></div>

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

**Related To:**  
[Token](/developers/mobile-sdk/class-reference/flutter/client#token)

**Class:**  
[ClientImpl](/developers/mobile-sdk/class-reference/flutter/modules#client)
  

<div class="content-tabs" data-tab-group="tabgrp-922">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-922-0" data-tab-group="tabgrp-922" data-tab-active="true">SDK &gt;= 1.0.0</button><button class="tab-button" data-tab-id="tabgrp-922-1" data-tab-group="tabgrp-922">Legacy SDK</button></div>

<div class="tab-panel" data-tab-id="tabgrp-922-0" data-tab-group="tabgrp-922" data-tab-active="true">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;void&gt; retrieveToken({required void Function(Token) onSuccess, required void Function(SyneriseError) onError}) async</code></pre>

  
**Parameters:**  
| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| **onSuccess** | Function([Token](/developers/mobile-sdk/class-reference/flutter/client#token) token) | yes | - | Function to be executed when the operation is completed successfully |
| **onError** | Function([SyneriseError](/developers/mobile-sdk/class-reference/flutter/miscellaneous#syneriseerror) error) | yes | - | Function to be executed when the operation is completed with an error |
  
**Return Value:**  
No value is returned.
  
**Example:**  

<pre><code class="language-Dart">await Synerise.client.retrieveToken(onSuccess: (Token token) {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});</code></pre>

</div>

<div class="tab-panel" data-tab-id="tabgrp-922-1" data-tab-group="tabgrp-922">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;Token&gt; retrieveToken() async</code></pre>

  
**Return Value:**  
[Token](/developers/mobile-sdk/class-reference/flutter/client#token)
  
**Example:**  

<pre><code class="language-Dart">Token token = await  Synerise.client.retrieveToken().catchError((error)</code></pre>

</div>
</div>


## Get current customer UUID
---
This method retrieves the customer’s current UUID.
**Declared In:**  
lib/modules/client/client_impl.dart

**Class:**  
[ClientImpl](/developers/mobile-sdk/class-reference/flutter/modules#client)


<div class="content-tabs" data-tab-group="tabgrp-923">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-923-0" data-tab-group="tabgrp-923" data-tab-active="true">SDK &gt;= 1.0.0</button><button class="tab-button" data-tab-id="tabgrp-923-1" data-tab-group="tabgrp-923">Legacy SDK</button></div>

<div class="tab-panel" data-tab-id="tabgrp-923-0" data-tab-group="tabgrp-923" data-tab-active="true">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;String&gt; getUUID() async</code></pre>


**Return Value:**  
String

**Example:**  

<pre><code class="language-Dart">await Synerise.client
        .getUUID()
        .then((result) =&gt; {
        //result handling
        });</code></pre>

</div>

<div class="tab-panel" data-tab-id="tabgrp-923-1" data-tab-group="tabgrp-923">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;String&gt; getUUID() async</code></pre>


**Return Value:**  
String

**Example:**  

<pre><code class="language-Dart">String uuid = await  Synerise.client.getUUID().catchError((error)</code></pre>

</div>
</div>


## 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.

This operation clears the authentication token, login (if applicable), custom email, and custom identifier.
  
| | **iOS SDK** | **Android SDK** | **React Native SDK** | **Flutter SDK** |
| --- | --- | --- | --- | --- |
| <span style="color:green">Introduced in:</span> | 3.3.10 | 3.3.5 | 0.9.0 | 0.7.0 |
**Declared In:**  
lib/modules/client/client_impl.dart
  
**Class:**  
[ClientImpl](/developers/mobile-sdk/class-reference/flutter/modules#client)
  
**Declaration:**  

<pre><code class="language-Dart">Future&lt;void&gt; regenerateUUID() async</code></pre>

  
**Return Value:**  
No value is returned.
  
**Example:**  

<pre><code class="language-Dart">await Synerise.client
        .regenerateUUID()
        .then((result) =&gt; {
        //result handling
        });</code></pre>


## Regenerate customer with identifier
---
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.
  
This operation clears the authentication token, login (if applicable), custom email, and custom identifier
  
The optional `clientIdentifier` parameter is a seed for UUID generation.
  
| | **iOS SDK** | **Android SDK** | **React Native SDK** | **Flutter SDK** |
| --- | --- | --- | --- | --- |
| <span style="color:green">Introduced in:</span> | 3.6.5 | 3.6.4 | 0.9.10 | 0.7.2 |
**Declared In:**  
lib/modules/client/client_impl.dart

**Class:**  
[ClientImpl](/developers/mobile-sdk/class-reference/flutter/modules#client)
  
**Declaration:**  

<pre><code class="language-Dart">Future&lt;void&gt; regenerateUUIDWithClientIdentifier(String clientIdentifier) async</code></pre>


**Parameters:**  
| Parameter | Type | Mandatory | Description |
| --- | --- | --- | --- |
| **clientIdentifier** | String | no | Seed for UUID generation |
  

<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

The **clientIdentifier** parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer.

</div></div></div>

  
**Return Value:**  
No value is returned.

**Example:**

<pre><code class="language-Dart">await Synerise.client
        .regenerateUUIDWithClientIdentifier(clientIdentifier)
        .then((result) =&gt; {
        //result handling
        });</code></pre>


## 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](/developers/mobile-sdk/class-reference/flutter/modules#client)


<div class="content-tabs" data-tab-group="tabgrp-924">
<div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-924-0" data-tab-group="tabgrp-924" data-tab-active="true">SDK &gt;= 1.0.0</button><button class="tab-button" data-tab-id="tabgrp-924-1" data-tab-group="tabgrp-924">Legacy SDK</button></div>

<div class="tab-panel" data-tab-id="tabgrp-924-0" data-tab-group="tabgrp-924" data-tab-active="true">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;void&gt; destroySession({required void Function() onSuccess, required void Function(SyneriseError) onError}) async</code></pre>


**Parameters:**  
| Parameter | Type | Mandatory | Default | Description |
| --- | --- | --- | --- | --- |
| **onSuccess** | Function() | yes | - | Function to be executed when the operation is completed successfully |
| **onError** | Function([SyneriseError](/developers/mobile-sdk/class-reference/flutter/miscellaneous#syneriseerror) error) | yes | - | Function to be executed when the operation is completed with an error |

**Return Value:**  
No value is returned.

**Example:**  

<pre><code class="language-Dart">await Synerise.client.destroySession(onSuccess: () {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});</code></pre>

</div>

<div class="tab-panel" data-tab-id="tabgrp-924-1" data-tab-group="tabgrp-924">

**Declaration:**  

<pre><code class="language-Dart">Future&lt;void&gt; destroySession() async</code></pre>

  
**Return Value:**  
No value is returned.

**Example:**  

<pre><code class="language-Dart">await  Synerise.client.destroySession().catchError((error)</code></pre>

</div>
</div>
