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.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

checkToken #

Checks a JWT Token's validity.

Signature #

kuzzleio::token_validity* checkToken(const std::string& token);

Arguments #

ArgumentsTypeDescription
token
string
JWT token

Return #

A pointer to a token_validity struct which has:

NameTypeDescription
valid
bool
Token validity
state
const char*
Explain why the token is invalid
expires_at
unsigned long long
Token expiration timestamp

Exceptions #

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

Usage #

try {
  std::string jwt = kuzzle->auth->login(
    "local",
    R"({"username":"foo","password":"bar"})");
  kuzzleio::token_validity* res = kuzzle->auth->checkToken(jwt);
  if (res->valid)
    std::cout << "Success" << std::endl;
  else
    std::cerr << res->state << std::endl;
} catch (kuzzleio::KuzzleException &e) {
  std::cerr << e.what() << std::endl;
}