Authentification
Description
Cette route est utilisée pour récupérer un access token à des fins d'authentification et d'autorisations.
Endpoint
POST https://auth.mytalentplug.com/realms/partners/protocol/openid-connect/token
Authentification
- Requise : Non
Requête
Le body de la requête doit être envoyée au format x-www-form-urlencoded.
Body (JSON)
{
"client_id": "string",
"client_secret": "string",
"grant_type": "client_credentials"
}
| Champ | Type | Requis | Par défaut | Format | Exemple | Description |
|---|---|---|---|---|---|---|
| client_id | string | Oui | — | — | mon-client-id | L'identifiant du client |
| client_secret | string | Oui | — | — | GiN44Rpch5MmpyggsKIBbPfXpjPvCwfef | La clé secrète du client |
| grant_type | string | Oui | — | — | client_credentials | Le type d'authentification utilisé |
Réponse
La réponse est au format JSON.
Réponse 200 (succès)
Exemple
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"expires_in": 1800,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0,
"scope": ""
}
Réponses d’erreur
| Code HTTP | Message | Description |
|---|---|---|
400 | Bad Request | Paramètre invalide (ex : paramètre manquant) |
401 | Unauthorized | Informations de connexion erronées |
500 | Internal Server Error | Le serveur a rencontré un problème inattendu |
Exemple
Réponse 400 Bad Request
{
"error": "invalid_request",
"error_description": "Missing form parameter: grant_type"
}
Réponse 401 Unauthorized
{
"error": "invalid_client",
"error_description": "Invalid client or Invalid client credentials"
}
Exemple de requête avec curl
curl -X POST 'https://auth.mytalentplug.com/realms/partners/protocol/openid-connect/token' -H 'Content-Type: application/x-www-form-urlencoded' -d 'client_id=myclientid' -d 'client_secret=myclientsecret' -d 'grant_type=client_credentials'