Skip to content

Refresh an Access token

Refresh an Access token.

POST /oauth/token/refresh/

Headers

NameValue
AuthorizationBearer Base64Encoded(Client ID:Client Secret)
Content-Typeapplication/json

Payload

refreshrequired
string

Refresh token to obtain new access token

Response

{
"success": true,
"message": "string",
"access": "string",
"refresh": "string",
"expires_in": 0,
"org_identifier": "string"
}

Upcoming Security Enhancement: Refresh Token Invalidation

Section titled “Upcoming Security Enhancement: Refresh Token Invalidation”

This implementation follows standard OAuth 2.0 security best practices, using refresh-token rotation and reuse detection to mitigate refresh-token replay.

Token TypeLifetimeNotes
Access Token6 hoursStandard token lifetime for authenticating API requests
Refresh Token60 daysStandard token lifetime for the active refresh token
Rotated Token Grace Period (Security Update)30 secondsWindow during which a previously rotated token remains valid for in-flight requests

When a refresh request succeeds, FreJun generates a new refresh token (R2). To safely accommodate parallel application processes and temporary network retries, the previous token (R1) enters a 30-second grace period.

Initial Refresh:
Client presents R1 ──► FreJun returns Access Token 1 + R2 (New active refresh token)
[R1 enters 30-second grace period]
Concurrent Requests (within 30 seconds using R1):
Client presents R1
↓
FreJun validates R1 is within its 30-second grace period
↓
FreJun issues a NEW access token (e.g., Access Token 2, 3...)
↓
FreJun returns the SAME active refresh token R2
After 30 seconds:
R1 is permanently invalidated.

If a previously rotated refresh token is presented after the 30-second grace period, FreJun will treat this as a potential security incident (such as an attempted token replay attack).

Requests made with an invalidated refresh token will return HTTP 401 Unauthorized:

HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"success": false,
"message": "Refresh token has been revoked"
}

When a token chain is revoked:

  1. Account administrators receive an automated security alert email.
  2. The integration must complete the OAuth Authorization Flow to obtain new credentials.

Before this security update is enforced:

  1. Persist Tokens Dynamically: Replace your stored refresh token with the newly returned token after every successful refresh.
  2. Store Refresh Tokens Securely: Persist the latest refresh token in a secure token store. Never hardcode refresh tokens in source code, .env files, or other static configuration.
  3. Handle 401 Unauthorized Gracefully: Detect "Refresh token has been revoked" and trigger the re-authorization flow instead of retrying with the revoked token.