SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

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:

ArgumentTypeDescription
expiresIn
String
Set the token expiration duration (default: depends on Kuzzle configuration file)

Return #

A ConcurrentHashMap with the following properties:

PropertyTypeDescription
_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();