TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Exchange a refresh token for new tokens

POSThttps://api.testingapis.com/api/auth/jwt/refreshSign in to see this endpoint's URL

Refresh tokens are single use: each call returns a new one and the old one stops working. Presenting a refresh token that was already used is treated as theft: every refresh token from the same login is revoked, so the user has to log in again (reuse detection, RFC 9700).

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: JwtAuthControllerRefreshRequest. The refresh token to use.

Example body
{"refreshToken": "{{refreshToken}}"}

Responses

200
New access and refresh tokens.
400
refreshToken missing.
401
Refresh token invalid or expired, or already used (which also revokes its whole family).

Example

Request
curl -X POST "https://api.testingapis.com/api/auth/jwt/refresh" \
  -H "Content-Type: application/json" \
  -d '{"refreshToken": "{{refreshToken}}"}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI…
  "tokenType": "Bearer",
  "expiresIn": 900,
  "refreshToken": "jrt_b0f84f4f71e59e3231e4f56ae56a23c7bfa15f77",
  "user": {"username": "user", "role": "user", "name": "Uma User}
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.