SDK
SDK Jvm v1.x
2

CheckToken #

Checks an authentication token's validity.

:::: tabs ::: tab Java

Arguments #

public CompletableFuture<Map<String, Object>> checkToken(String token)
  throws NotConnectedException, InternalException
ArgumentTypeDescription
token
String
Authentication token

Return #

A Map which has the following properties:

PropertyTypeDescription
valid
Boolean
Token validity
state
String
Explain why the token is invalid
expiresAt
int
Token expiration timestamp

Usage #

Map<String, Object> credentials = new HashMap<>();
credentials.put("username", "foo");
credentials.put("password", "bar");
Map<String, Object> response =
  kuzzle.getAuthController().login("local", credentials).get();
Map<String, Object> responseToken =
  kuzzle.getAuthController().checkToken(response.get("jwt").toString()).get();

::: ::: tab Kotlin

Arguments #

fun checkToken(token: String): CompletableFuture<Map<String, Any?>>
ArgumentTypeDescription
token
String
Authentication token

Return #

A Map which has the following properties:

PropertyTypeDescription
valid
Boolean
Token validity
state
String
Explain why the token is invalid
expiresAt
Int
Token expiration timestamp

Usage #

val response = kuzzle.authController.login("local", HashMap<String, Any?>().apply {
  put("username", "foo")
  put("password", "bar")
}).get()
val responseToken: Map<String, Any?> =
  kuzzle.authController.checkToken(response["jwt"].toString()).get()

::: ::::