SDK
SDK C# v2.x
2

CheckTokenAsync #

Checks an authentication token's validity.

Arguments #

public async Task<JObject> CheckTokenAsync(string token);
ArgumentTypeDescription
token
string
Authentication token

Return #

A JObject which has the following properties:

PropertyTypeDescription
valid
bool
Token validity
state
string
Explain why the token is invalid
expires_at
Int64
Token expiration timestamp

Exceptions #

Throws a KuzzleException if there is an error. See how to handle error.

Usage #

try {
  JObject response = await kuzzle.Auth.LoginAsync(
    "local",
    JObject.Parse("{username: 'foo', password: 'bar'}"));
  JObject res = await kuzzle.Auth.CheckTokenAsync(
    response["jwt"]?.ToString());
  Console.WriteLine(res.ToString(Formatting.None));
  /*
  {
    "valid": true,
    "expiresAt": 1564563452570
  }
  */
} catch (KuzzleException e) {
  Console.WriteLine(e);
}