checkToken

Checks a JWT Token's validity.

Signature

Copied to clipboard!
TokenValidity checkToken(String);

Arguments

Arguments Type Description
token String the token

Return

A TokenValidity object which has:

Name Type Description
valid boolean Tell if the token is valid or not
state String Explain why the token is invalid
expires_at BigInteger Tells when the token expires

Exceptions

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

Usage

Copied to clipboard!
try {
  String token = kuzzle.getAuth().login("local", "{\"username\":\"foo\",\"password\":\"bar\"}");
  TokenValidity res = kuzzle.getAuth().checkToken(token);
  if (res.getValid() == true)
    System.out.println("Success");
  else
    System.err.println(res.getState());
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}