SDK
SDK C# v2.x
2

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 #

public async Task<JObject> GetMyCredentialsAsync(string strategy);
ArgumentTypeDescription
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 #

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);
}