Authentification API
Guide d'authentification pour l'API Maluro.
Vue d’ensemble
L’API Maluro utilise l’authentification par Bearer Token (JWT).
Obtenir un token
Endpoint
POST /api/auth/login
Content-Type: application/json Requête
{
"email": "votre@email.com",
"password": "votre_mot_de_passe"
} Réponse
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_at": "2024-01-16T12:00:00Z",
"user": {
"id": "usr_123",
"email": "votre@email.com",
"name": "Votre Nom"
}
} Le token expire après 24 heures. Pensez à le renouveler avant expiration.
Utiliser le token
Incluez le token dans le header Authorization :
GET /api/prospects
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... Exemple avec cURL
curl -X GET "https://api.maluro.com/api/prospects"
-H "Authorization: Bearer YOUR_TOKEN"
-H "Content-Type: application/json" Exemple avec JavaScript
const response = await fetch('https://api.maluro.com/api/prospects', {
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
}); Renouveler le token
POST /api/auth/refresh
Authorization: Bearer CURRENT_TOKEN Implémentez un mécanisme de renouvellement automatique dans votre application.
Erreurs d’authentification
| Code | Description |
|---|---|
| 401 | Token invalide ou expiré |
| 403 | Permissions insuffisantes |
Consultez les Endpoints disponibles.