Aller au contenu principal

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"
}
ChampTypeRequisPar défautFormatExempleDescription
client_idstringOuimon-client-idL'identifiant du client
client_secretstringOuiGiN44Rpch5MmpyggsKIBbPfXpjPvCwfefLa clé secrète du client
grant_typestringOuiclient_credentialsLe 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 HTTPMessageDescription
400Bad RequestParamètre invalide (ex : paramètre manquant)
401UnauthorizedInformations de connexion erronées
500Internal Server ErrorLe 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'