SDK
SDK C# v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

GetCurrentUserAsync #

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

Arguments #

public async Task<JObject> GetCurrentUserAsync();

Return #

A JObject representing the User.

PropertyTypeDescription
_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 #

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
      }
    },
    "_meta": {
      "author": "-1",
      "createdAt": 1564563030235,
      "updatedAt": null,
      "updater": null
    },
    "strategies": [
      "local"
    ]
  }
  */
  Console.WriteLine("Successfully got current user");
} catch (KuzzleException e) {
  Console.WriteLine(e);
}