Refresh Token
curl --request POST \
--url http://localhost:8000/auth/refreshimport requests
url = "http://localhost:8000/auth/refresh"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('http://localhost:8000/auth/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_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/auth/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/auth/refresh"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8000/auth/refresh")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/auth/refresh")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 123,
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "<string>",
"token_type": "bearer",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authentication
Refresh Token
Re-issue a JWT for the currently authenticated user, extending expiry.
Validates the existing token via the standard auth dependency and issues
a fresh token with the same user/tenant/role context. The old token
remains valid until its original exp claim, but the client must use
the new one from this point forward.
Args: user_id: Authenticated user ID (resolved from current JWT) current_user: Full user context including tenant_id and role
Returns: TokenResponse: New JWT with extended expiry
Raises: HTTPException 401: If the request carries no valid token
POST
/
auth
/
refresh
Refresh Token
curl --request POST \
--url http://localhost:8000/auth/refreshimport requests
url = "http://localhost:8000/auth/refresh"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('http://localhost:8000/auth/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_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/auth/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/auth/refresh"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8000/auth/refresh")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/auth/refresh")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 123,
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "<string>",
"token_type": "bearer",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Cookies
Response
Successful Response