1. Home
  2. Docs
  3. UniREST Solution 3.5
  4. UniREST Client
  5. Token Manager
  6. Tokens Update

Tokens Update

You can change the 3 user’s Tokens at any moment. However, keep in mind that, inside the UniREST System, a Token is stored in two locations:

  • in the server-side, in the user’s record saved into the database users table;
  • in the client-side, internally to the UniRESTClient class.

By default, when you use the methods for updating a Token, the new Token is generated in the server, saved into the user’s record, released to the UniRESTClient class and, finally, integrated into the client. Basically, this means that when you update a Token, that Token becomes the new user’s Token.

However, you may want to have total control of this process. In this scenario, the updating methods can be instructed to update the user’s record, and release the new Token, but not integrate this Token into the client. Finally, manually integrate the new Token when needed.


UpdateLogin(), UpdateRead(), UpdateWrite()

The Update*() methods change the user’s Tokens. By default, the updating process integrates the new token into the UniRESTClient class.

_ = #UniRESTClient#.#Async#.#TokenManager#.$UpdateLogin$(%callBack%, ^integrateToken^);

_ = #UniRESTClient#.#Async#.#TokenManager#.$UpdateRead$(%callBack%, ^integrateToken^);

_ = #UniRESTClient#.#Async#.#TokenManager#.$UpdateWrite$(%callBack%, ^integrateToken^);

doneCallback|function(bool, string)
The function to call when the operation will be completed.

It must have 2 parameters:
– bool param: true if the operation succeeded;
– string param: the new Token.
__
integrateToken|(bool)
Default: true

When true (by default), the new Token is integrated into the UniREST System.
When false, the new Token is not integrated and you have to integrate it manually, using the Integrate*() methods.

_ = UniRESTClient.Async.TokenManager.UpdateLogin(
    (bool ok, string token) => 
    {
          if (ok)
          {
              Debug.Log("Your new Token is: " + token);  
          } else {
              Debug.LogError("Error!");
          }
    });