validateMyCredentials

Validate the current user's credentials for the specified strategy. The result field is true if the provided credentials are valid; otherwise an error is triggered. This route does not actually create or modify the user credentials. The credentials to send will depend on the authentication plugin and authentication strategy.

Signature

Copied to clipboard!
bool validateMyCredentials(
    const std::string& strategy,
    const std::string& credentials);

bool validateMyCredentials(
    const std::string& strategy,
    const std::string& credentials,
    const kuzzleio::query_options& options);

Arguments

Arguments Type Description
strategy
const std::string&
Strategy to use
credentials
const std::string&
JSON string representing the credentials
options
kuzzleio::query_options*
Query options

options

Additional query options

Property Type
(default)
Description
queuable
bool

(true)
If true, queues the request during downtime, until connected to Kuzzle again

Return

A boolean indicating if the credentials are valid.

Usage

Copied to clipboard!
try {
  kuzzle->auth->login("local", R"({"username":"foo","password":"bar"})");
  bool valid = kuzzle->auth->validateMyCredentials("local", R"({"username":"foo","password":"bar"})");

  if (valid) {
    std::cout << "Credentials are valid" << std::endl;
  }
} catch (kuzzleio::KuzzleException &e) {
  std::cerr << e.what() << std::endl;
}