RefreshToken #
Refreshes an authentication token.
- a valid, non-expired authentication must be provided
- the provided authentication token is revoked
- a new authentication token is generated and returned
Arguments #
CompletableFuture<ConcurrentHashMap<String, Object>> refreshToken(
final String expiresIn) throws NotConnectedException, InternalException
Optional:
Argument | Type | Description |
---|---|---|
expiresIn | String | Set the token expiration duration (default: depends on Kuzzle configuration file) |
Return #
A ConcurrentHashMap with the following properties:
Property | Type | Description |
---|---|---|
_id | String | User's kuid |
jwt | String | Encrypted authentication token, that must then be sent in the requests headers or in the query |
expiresAt | int | Token expiration date, in Epoch-millis (UTC) |
ttl | int | Token time to live, in milliseconds |
Once auth:refreshToken has been called, the returned authentication token is stored by the SDK and used for all the subsequent API calls. |
Usage #
ConcurrentHashMap<String, Object> credentials = new ConcurrentHashMap<>();
credentials.put("username", "foo");
credentials.put("password", "bar");
kuzzle.getAuthController().login("local", credentials).get();
ConcurrentHashMap<String, Object> result =
kuzzle.getAuthController().refreshToken("1h").get();
Edit this page on Github(opens new window)