Token Refresh
https://api.apptenticate.com/api/token/refresh/
This endpoint is used to renew a previously obtained JWT token. By providing the associated refresh token, you can obtain a new JWT token without the need to re-authenticate. This process is useful for maintaining user authentication, even after the original JWT token has expired.
Request data
| Field | Type | Description |
|---|---|---|
| refresh | string | Refresh token obtained when requesting the JWT access token |
Request example
- Shell
- Node
- Python
Request
curl --location 'https://api.apptenticate.com/api/token/refresh/' \
--form 'refresh=<refresh_token>'
Instalación
npm install axios form-data
Request
const axios = require('axios')
const FormData = require('form-data')
let data = new FormData()
data.append('refresh', '<refresh_token>')
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.apptenticate.com/api/token/refresh/',
headers: {
...data.getHeaders()
},
data: data
}
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data))
})
.catch((error) => {
console.log(error)
})
Instalación
python -m pip install requests
Request
import requests
url = "https://api.apptenticate.com/api/token/refresh/"
payload = {'refresh': '<refresh_token>'}
response = requests.post(url, data=payload)
print(response.text)
Request data
| Field | Type | Description |
|---|---|---|
| access | string | JWT access token |
Example of a successful request
status_code 200
{
"access": "eyJhbGciOiJJ0b2tlbl90eXBlI6IkpXVCJ9.eyJ0b2tlbl90eXBlIj..."
}
Example of a failed request
status_code 401
{
"detail": "Token is invalid or expired",
"code": "token_not_valid"
}