CheckToken #
Checks an authentication token's validity.
:::: tabs ::: tab Java
Arguments #
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 #
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?>>
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 #
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()
::: ::::
Edit this page on Github(opens new window)