SDK
SDK C# v2.x
2

GetCurrentUserAsync #

Returns informations about the user currently loggued with the SDK instance.

Arguments #

Copied to clipboard!
public async Task<JObject> GetCurrentUserAsync();

Return #

A JObject representing the User.

Property Type Description
_id
string
Representing the current user kuid
strategies
JArray
Available authentication strategies for that user
_source
JObject
User information

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 user = await kuzzle.Auth.GetCurrentUserAsync();
  Console.WriteLine(user.ToString(Formatting.None));
  /*
  {
    "_id": "foo",
    "_source": {
      "profileIds": [
        "default"
      ],
      "_kuzzle_info": {
        "author": "-1",
        "createdAt": 1564563030235,
        "updatedAt": null,
        "updater": null
      }
    }
    "strategies": [
      "local"
    ]
  }
  */
  Console.WriteLine("Successfully got current user");
} catch (KuzzleException e) {
  Console.WriteLine(e);
}