CredentialsExistAsync

Checks that the current user has credentials for the specified strategy.

Arguments

Copied to clipboard!
public async Task<bool> CredentialsExistAsync(string strategy);
Argument Type Description
strategy
string
Strategy to use

Return

A boolean indicating if credentials exists for the strategy.

Exceptions

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

Usage

Copied to clipboard!
try {
  await kuzzle.Auth.LoginAsync(
    "local",
    JObject.Parse("{username: 'foo', password: 'bar'}"));
  bool exists = await kuzzle.Auth.CredentialsExistAsync("local");
  if (exists) {
    Console.WriteLine("Credentials exists for local strategy");
  }
} catch (KuzzleException e) {
  Console.WriteLine(e);
}