Refresh Expired Access Token
curl --request POST \
--url https://api.example.com/api/identity/token/refresh \
--header 'Content-Type: application/json' \
--data '
{
"refresh_token": "dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY..."
}
'import requests
url = "https://api.example.com/api/identity/token/refresh"
payload = { "refresh_token": "dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY..." }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({refresh_token: 'dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...'})
};
fetch('https://api.example.com/api/identity/token/refresh', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/identity/token/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'refresh_token' => 'dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/identity/token/refresh"
payload := strings.NewReader("{\n \"refresh_token\": \"dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/identity/token/refresh")
.header("Content-Type", "application/json")
.body("{\n \"refresh_token\": \"dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/identity/token/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"refresh_token\": \"dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfMDE4ZjNhNTUiLCJleHAiOjE3MTgwMDM2MDB9.new_sig",
"refresh_token": "dGhpcy1pcy1hLW5ldy1yZWZyZXNoLXRva2Vu...",
"token_type": "bearer",
"expires_in": 3600
}{
"detail": "Invalid or expired refresh token"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authentication
Refresh Expired Access Token
Overview
Issues a fresh access_token using an unexpired refresh_token without requiring the user to re-enter credentials.
Authentication & Headers
- Auth: Public / Refresh Token
- Required Header:
API-Version: 1
Parameters & Request Body
refresh_token(string, required): The long-lived refresh token obtained during initial login.
POST
/
api
/
identity
/
token
/
refresh
Refresh Expired Access Token
curl --request POST \
--url https://api.example.com/api/identity/token/refresh \
--header 'Content-Type: application/json' \
--data '
{
"refresh_token": "dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY..."
}
'import requests
url = "https://api.example.com/api/identity/token/refresh"
payload = { "refresh_token": "dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY..." }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({refresh_token: 'dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...'})
};
fetch('https://api.example.com/api/identity/token/refresh', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/identity/token/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'refresh_token' => 'dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/identity/token/refresh"
payload := strings.NewReader("{\n \"refresh_token\": \"dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/identity/token/refresh")
.header("Content-Type", "application/json")
.body("{\n \"refresh_token\": \"dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/identity/token/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"refresh_token\": \"dGhpcy1pcy1hLXNlY3VyZS1yZWZyZXNoLXRva2VuLTIwMjY...\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfMDE4ZjNhNTUiLCJleHAiOjE3MTgwMDM2MDB9.new_sig",
"refresh_token": "dGhpcy1pcy1hLW5ldy1yZWZyZXNoLXRva2Vu...",
"token_type": "bearer",
"expires_in": 3600
}{
"detail": "Invalid or expired refresh token"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}