SDK
SDK C# v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

CheckTokenAsync #

Checks a JWT Token's validity.

Arguments #

public async Task<JObject> CheckTokenAsync(string token);
ArgumentTypeDescription
token
string
JWT 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);
}