GetMyCredentialsAsync

Returns the current user's credential information for the specified strategy. The data returned will depend on the specified strategy. The result can be an empty string.

Arguments

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

Return

Returns a JObject representing the credentials for the provided authentication 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'}"));
  JObject local_credentials = await kuzzle.Auth.GetMyCredentialsAsync("local");

  Console.WriteLine(local_credentials.ToString(Formatting.None));
  /*
  {
    "username": "foo",
    "kuid": "foo"
  }
  */
  Console.WriteLine("Successfully got local credentials");
} catch (KuzzleException e) {
  Console.WriteLine(e);
}