POST /auth/refresh
当访问令牌过期时,调用此接口获取新的访问令牌。须提供有效的刷新令牌。本接口采用令牌轮换以增强安全:每次刷新都会签发新的刷新令牌,旧令牌自动作废。
请求体
string
必填
登录或上次刷新时获得的刷新令牌。
响应
boolean
刷新是否成功。
string
可读的状态说明。
object
新的鉴权令牌对象。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
curl -X POST https://api.llmgenerator.com/api/v1/auth/refresh \
-H "Content-Type: application/json" \
-d '{
"refreshToken": "YOUR_REFRESH_TOKEN"
}'
const response = await fetch('https://api.llmgenerator.com/api/v1/auth/refresh', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
refreshToken: 'YOUR_REFRESH_TOKEN'
})
});
const data = await response.json();
{
"success": true,
"message": "Token refreshed successfully",
"tokens": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 900,
"tokenType": "Bearer"
}
}
{
"message": "Invalid or expired refresh token"
}
{
"message": "Refresh token has been revoked"
}
用刷新令牌换取新的访问令牌。
curl -X POST https://api.llmgenerator.com/api/v1/auth/refresh \
-H "Content-Type: application/json" \
-d '{
"refreshToken": "YOUR_REFRESH_TOKEN"
}'
const response = await fetch('https://api.llmgenerator.com/api/v1/auth/refresh', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
refreshToken: 'YOUR_REFRESH_TOKEN'
})
});
const data = await response.json();
{
"success": true,
"message": "Token refreshed successfully",
"tokens": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 900,
"tokenType": "Bearer"
}
}
{
"message": "Invalid or expired refresh token"
}
{
"message": "Refresh token has been revoked"
}
此页面对您有帮助吗?