Auth Token
Genere un token JWT pour l'authentification dans les autres requetes de l'API.
Endpoint
POST /api/v2/external/auth-tokenEn-tetes
| En-tete | Valeur | Obligatoire |
|---|---|---|
| Content-Type | application/json | Oui |
Request Body
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
client_id | string | Oui | Identifiant de l'API Key |
client_secret | string | Oui | Cle secrete de l'API Key |
json
{
"client_id": "votre-api-key-id",
"client_secret": "votre-api-key-secret"
}Exemple
bash
curl -X POST https://api.owem.com.br/api/v2/external/auth-token \
-H "Content-Type: application/json" \
-d '{
"client_id": "votre-api-key-id",
"client_secret": "votre-api-key-secret"
}'Reponse 200
json
{
"worked": true,
"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}| Champ | Type | Description |
|---|---|---|
worked | boolean | Indique le succes de l'operation |
access_token | string | Token JWT a utiliser dans les en-tetes |
token_type | string | Toujours Bearer |
expires_in | integer | Validite en secondes (3600 = 60 minutes) |
Reponse 401
json
{
"worked": false,
"detail": "Identifiants invalides"
}Utilisation du Token
Incluez le token dans l'en-tete Authorization de toutes les requetes suivantes :
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...Validite
Le token expire dans 60 minutes. Implementez un renouvellement automatique avant l'expiration.