code | type | title | description |
---|---|---|---|
true |
page |
refreshToken |
Refresh an authentication token |
Refreshes a valid, non-expired authentication token.
If this action is successful, then the jwt property of this class instance is set to the new authentication token.
All further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the logout action is called, or the jwt
property is manually set to another value.
refreshToken ([options])
Arguments | Type | Description |
---|---|---|
options |
object |
Query options |
Additional query options
Property | Type (default) |
Description |
---|---|---|
expiresIn |
string |
Expiration time in ms library format. (e.g. 2h ) |
queuable |
boolean ( true ) |
If true, queues the request during downtime, until connected to Kuzzle again |
timeout |
number ( -1 ) |
Time (in ms) during which a request will still be waited to be resolved. Set it -1 if you want to wait indefinitely |
The default value for the expiresIn
option is defined at server level, in Kuzzle's configuration file.
The refreshToken
action resolves to a token object with the following properties:
Property | Type | Description |
---|---|---|
_id |
string |
User unique identifier (kuid) |
expiresAt |
number |
Expiration timestamp in Epoch-millis format (UTC) |
jwt |
string |
Authentication token (returned only if the option cookieAuth is not enabled in the SDK, otherwise stored in an http cookie) |
ttl |
number |
Time to live of the authentication token, in milliseconds |
<<< ./snippets/refreshToken.js