Token
Exchange JWT
Exchanges a user’s JWT for a new, short-lived token using the application’s
access key. The new token has its audience (aud) set to the application’s ID
and its expiration (exp) set to 10 minutes from the request time, while the
original iat (“issued at”) claim remains unchanged. A new rat (“reissued
at”) claim is added to record the reissue timestamp in Unix time. All other
claims from the original token are preserved.
JWT Claim Updates:
aud: set to the application IDexp: set to 10 minutes from the request timerat: set to the request timestamp (Unix time)
Access Requirements
A valid application access key must be provided in the
Authorization: Bearer header.
Note
Token expiration is automatically set to 10 minutes from the request time.
Request
POST /api/permissions/exchangeJwt
Response
Success: 200 OK
Forbidden: 403 Forbidden
{
"status": "ERROR",
"error": "Wrong access key"
}
Internal Error: 500 Internal Server Error
Refresh JWT
Refreshes the expiration time and selected user claims for a given JWT. The
method validates the request using a combination of the JWT (provided in the
header or body) and a digital signature (Request-Sign header). If the request is
valid, it generates a new JWT with refreshed expiration (exp) and updated user
information: nickname (nick), tags (tgs), and “reissued at” (rat) fields.
Access Requirements
The request must include a valid JWT in the
Authorization: Bearer header and a
valid Request-Sign signature.
Note
If the provided token has expired but the request is otherwise valid, it still allows refreshing the token.
Request
POST /api/permissions/refreshJwt
Response
Success: 200 OK
Bad Request: 400 Bad Request
{
"status": "ERROR",
"error": "Wrong request format"
}
Forbidden: 403 Forbidden
{
"status": "ERROR",
"error": "Wrong token source"
}
Internal Error: 500 Internal Server Error
{
"status": "ERROR",
"error": "Cannot create new JWT"
}