Token Request
When you make a request to this endpoint, you will get a JWT and you can use it for authentication against Apptenticate services. The token lasts for 5 minutes.
Request data
| Field | Type | Description |
|---|---|---|
| username | string | Username |
| password | string | Password |
Request example
- Shell
- Node
- Python
Request
curl --location 'https://api.apptenticate.com/api/token/' \
--form 'username="<username>"' \
--form 'password="<password>"'
Instalación
npm install axios form-data
Request
const axios = require('axios')
const FormData = require('form-data')
let data = new FormData()
data.append('username', '<username>')
data.append('password', '<password>')
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.apptenticate.com/api/token/',
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/"
payload = {'username': '<username>','password': '<password>'}
response = requests.post(url, data=payload)
print(response.text)
Response data
| Field | Type | Description |
|---|---|---|
| refresh | string | Refresh token to obtain a new JWT access token |
| access | string | JWT access token |
Example of a successful response
status_code 200
{
"refresh": "eyJhbGciOiJJ0b2tlbl90eXBlI6IkpXVCJ9.eyJ0b2tlbl90eXBlI...",
"access": "eyJhbGciOiJJ0b2tlbl90eXBlI6IkpXVCJ9.eyJ0b2tlbl90eXBlIj..."
}
Example of a failed response
status_code 401
{
"detail": "No active account found with the given credentials"
}