SDK
SDK C# v2.x
2

ValidateMyCredentialsAsync #

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.

Arguments #

public async Task<bool> ValidateMyCredentialsAsync(
      string strategy,
      JObject credentials);
ArgumentTypeDescription
strategy
string
Strategy to use
credentials
JObject
JObject representing the credentials

Return #

A boolean indicating if the credentials are valid.

Usage #

try {
  await kuzzle.Auth.LoginAsync(
    "local",
    JObject.Parse("{username: 'foo', password: 'bar'}"));
  bool valid = await kuzzle.Auth.ValidateMyCredentialsAsync(
    "local",
    JObject.Parse("{username: 'foo', password: 'bar'}"));
  if (valid) {
    Console.WriteLine("Credentials are valid");
  }
} catch (KuzzleException e) {
  Console.WriteLine(e);
}