CheckTokenAsync #
Checks an authentication token's validity.
Arguments #
public async Task<JObject> CheckTokenAsync(string token);
Argument | Type | Description |
---|---|---|
token | string | Authentication token |
Return #
A JObject which has the following properties:
Property | Type | Description |
---|---|---|
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);
}
Edit this page on Github(opens new window)