Token request#
On this page
The token endpoint exchanges an authorisation code for an ID token that contains verified identity claims.
Endpoint#
POST /tokenRequest format#
Headers#
Content-Type: application/x-www-form-urlencodedParameters#
| Parameter | Required | Type | Description |
|---|---|---|---|
client_id | Yes | string | The OAuth client identifier |
client_assertion_type | Yes | string | Must be urn:ietf:params:oauth:client-assertion-type:jwt-bearer |
client_assertion | Yes | string | Signed JSON Web Token (JWT) for client authentication |
grant_type | Yes | string | Must be authorization_code |
code | Yes | string | Authorisation code from the callback |
code_verifier | Yes | string | Proof Key for Code Exchange (PKCE) code verifier (43-128 characters) |
redirect_uri | Yes | string | Must match the redirect_uri from the pushed authorisation request (PAR) |
Example request#
POST /token HTTP/1.1
Host: {base-url}
Content-Type: application/x-www-form-urlencoded
client_id=dip_aci_your_client_id
&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer
&client_assertion=eyJhbGciOiJFUzI1NiIsImtpZCI6Im15LWtleSIsInR5cCI6IkpXVCJ9...
&grant_type=authorization_code
&code=SplxlOBeZQQYbYS6WxSbIA
&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
&redirect_uri=https://client.example.org/callbackClient assertion JWT#
The client assertion authenticates the client. See Authentication for full details.
Header (3 claims exactly):
{
"alg": "ES256",
"kid": "my-signing-key",
"typ": "JWT"
}Payload (4 required claims):
{
"iss": "dip_aci_your_client_id",
"sub": "dip_aci_your_client_id",
"aud": "https://{base-url}",
"exp": 1759835872
}Note: ID Check accepts the standard JWT claims
iat,jti, andnbf, but does not require them. ID Check rejects any other claims.
Response#
Success response (200 OK)#
Response headers#
| Header | Value |
|---|---|
Content-Type | application/json |
Cache-Control | no-store |
Pragma | no-cache |
Response body#
{
"id_token": "eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIiwia2lkIjoiZGlwLWVuYy1rZXkifQ...",
"access_token": "not_applicable",
"token_type": "Bearer",
"expires_in": 900
}| Field | Type | Description |
|---|---|---|
id_token | string | Encrypted JWT in JSON Web Encryption (JWE) format, which contains the signed ID token |
access_token | string | Placeholder value. ID Check is an identity verification service where the ID token is the primary artefact. |
token_type | string | OAuth 2.0 token type. Always Bearer. |
expires_in | number | Token lifetime in seconds |
Error response#
{
"error": "invalid_request",
"error_description": "Session expired"
}Error codes#
| Error | HTTP status | Description |
|---|---|---|
invalid_request | 400 | Missing or invalid parameters, redirect URI mismatch, or invalid session state |
invalid_grant | 400 | The session has expired |
invalid_client | 401 | Client authentication failed (unknown client or invalid credentials) |
not_found | 404 | Session not found for the given authorisation code |
access_denied | 404 | Unauthorised session access or PKCE verification failure |
server_error | 500 | Internal server error |
ID token format#
The id_token is a JSON Web Encryption (JWE) that contains a signed JWT.
Encryption details#
| Property | Value |
|---|---|
| Algorithm | RSA-OAEP-256 |
| Encryption | A256GCM |
| Content | Signed JWT (nested) |
Decryption process#
- 1
Parse the JWE
- 2
Decrypt using the client's private key
- 3
Extract the signed JWT from the payload
- 4
Verify the JWT signature using the ID Check public key (from
/jwks) - 5
Validate claims
Signed JWT details#
| Property | Value |
|---|---|
| Algorithm | ES256 |
| Type | jwt |
Complete ID token structure#
After decryption and signature verification, the ID token contains:
{
"iss": "https://{base-url}",
"sub": "hashed-pairwise-subject-identifier",
"aud": "dip_aci_your_client_id",
"exp": 1759839472,
"iat": 1759835872,
"auth_time": 1759835872,
"jti": "e29b7c1e-6b4a-4a3b-9b1a-2f6c8a7d5e10",
"nonce": "n-0S6_WzA2Mj",
"acr": "urn:bankid:idcheck",
"amr": ["face", "user"],
"verified_claims": {
"verification": {
"trust_framework": "stoe",
"evidence": [
{
"type": "document",
"check_details": [
{
"check_method": "vcrypt",
"result": "success"
},
{
"check_method": "data",
"organization": "id.politiet.no",
"result": "valid"
}
],
"document_details": {
"type": "passport",
"document_number": "AB1234567",
"date_of_issuance": "2020-01-15",
"date_of_expiry": "2030-01-15",
"issuer": {
"country_code": "NOR",
"name": "INNLANDET POLITIDISTRIKT"
},
"personal_number": "12345678901"
}
}
]
},
"claims": {
"given_name": "AASAMUND SPECIMEN",
"family_name": "OESTENBYEN",
"birthdate": "1990-01-15",
"gender": "male",
"nationalities": ["NOR"]
}
}
}See ID token for complete claim documentation.
Validation checklist#
After decrypting the ID token, validate the following:
| Claim | Validation |
|---|---|
iss | Must match the ID Check issuer URL |
aud | Must match the client_id |
exp | Must not be expired (current time < exp) |
iat | Must not be in the future |
nonce | Must match the nonce from the PAR request |
acr | Should be urn:bankid:idcheck |
| Signature | Must be valid using the ID Check public key |
Next steps#
- ID token - Complete ID token structure and claim details
- Authentication - JWT requirements
- API reference - OpenID discovery endpoint