SDK
SDK Jvm v1.x
2

GetCurrentUserAsync #

Returns information about the user currently logged with the SDK instance.

:::: tabs ::: tab Java

Arguments #

Copied to clipboard!
public CompletableFuture<Map<String, Object>> getCurrentUser()
  throws NotConnectedException, InternalException

Return #

A Map representing the User.

Property Type Description
_id
String
Representing the current user kuid
strategies
Array
Available authentication strategies for that user
_source
Map
User information

Usage #

Copied to clipboard!
Map<String, Object> credentials = new HashMap<>();
credentials.put("username", "foo");
credentials.put("password", "bar");
kuzzle.getAuthController().login("local", credentials).get();
Map<String, Object> result = kuzzle.getAuthController().getCurrentUser().get();

::: ::: tab Kotlin

Arguments #

Copied to clipboard!
fun getCurrentUser(): CompletableFuture<Map<String, Any?>>

Return #

A Map representing the User.

Property Type Description
_id
String
Representing the current user kuid
strategies
Array
Available authentication strategies for that user
_source
Map
User information

Usage #

Copied to clipboard!
kuzzle.authController.login("local", HashMap<String, Any?>().apply {
  put("username", "foo")
  put("password", "bar")
}).get()
val result: Map<String, Any?> =
  kuzzle.authController.getCurrentUser().get()

::: ::::