SDK
SDK C# v1.x
1

# 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

Copied to clipboard!
public async Task<bool> ValidateMyCredentialsAsync(
      string strategy,
      JObject credentials);
Argument Type Description
strategy
string
Strategy to use
credentials
JObject
JObject representing the credentials

# Return

A boolean indicating if the credentials are valid.

# Usage

Copied to clipboard!
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);
}