SDK
SDK Jvm v1.x
2

CheckToken #

Checks an authentication token's validity.

:::: tabs ::: tab Java

Arguments #

Copied to clipboard!
public CompletableFuture<Map<String, Object>> checkToken(String token)
  throws NotConnectedException, InternalException
Argument Type Description
token
String
Authentication token

Return #

A Map which has the following properties:

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

Usage #

Copied to clipboard!
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 #

Copied to clipboard!
fun checkToken(token: String): CompletableFuture<Map<String, Any?>>
Argument Type Description
token
String
Authentication token

Return #

A Map which has the following properties:

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

Usage #

Copied to clipboard!
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()

::: ::::