🇫🇷 Français | 🇬🇧 English
The Authorization Code flow is the main integration method for L’Identité Numérique La Poste.
It allows partners to:
The flow is based on a multi-step exchange:
👉 This flow complies with the OpenID Connect standard.
The partner redirects the user to LINLP.
GET /authorize
Main parameters:
Example:
https://authent.pprod.lidentitenumerique.laposte.fr/auth/realms/partenaire/protocol/openid-connect/auth ?client_id=XXX &response_type=code &redirect_uri=https://myservice.com/callback &scope=openid+profile+email &state=abc123 &nonce=xyz456
💡 `login_hint` can be used to prefill the user’s phone number.
The user:
👉 Data consent is requested when required.
After success:
https://myservice.com/callback?code=ABC123&state=abc123
⚠️ The code:
The backend calls:
POST /token
Example:
grant_type=authorization_code code=ABC123 redirect_uri=https://myservice.com/callback
👉 Authentication is required through:
Response:
GET /userinfo Authorization: Bearer access_token
👉 Returns:
⚠️ The partner must retain the id_token
👉 Why?
👉 Use cases:
💡 Unlike the access_token, the id_token should be retained by the partner
| Case | Behavior |
|---|---|
| Invalid scope | Redirection with error=invalid_scope |
| Invalid client_id | HTTP 400 error |
| Invalid redirect_uri | HTTP 400 error |
| Case | Behavior |
|---|---|
| User refusal | Return to login page |
| Validation timeout | Return to login page |
| Unknown user | Timeout |
| Case | Description |
|---|---|
| Invalid code | invalid_grant |
| Expired code | invalid_grant |
| Invalid client_secret | unauthorized_client |
| Case | Description |
|---|---|
| Invalid token | invalid_token |
| Expired token | access denied |
⚠️ Always use a backend
⚠️ Validate the state parameter
⚠️ Validate the nonce
⚠️ Verify the id_token signature
⚠️ Handle expirations
⚠️ Log errors
⚠️ redirect_uri must match exactly
⚠️ Scopes must be declared in advance
⚠️ The flow is synchronous for the user
⚠️ Returned data depends on:
👉 For advanced use cases: