# Common errors

This page describes common errors that can occur during an integration with ID Check OIDC4IA.

> **Preview**
>
> ID Check OIDC4IA is in preview, so it can change. For a stable integration, use [ID Check](https://docs.stoe.no/id-check.md).

## Client assertion errors

### Unexpected claims in client assertion

**Error:** `unexpected claims in client assertion: [claim_name]`

**Cause:** The client assertion contains claims that ID Check does not recognise.

**Solution:** Make sure that the client assertion contains only the required claims (`iss`, `sub`, `aud`, `exp`) and optionally `iat`, `jti`, or `nbf`. Remove any other claims.

---

### Invalid client assertion type

**Error:** Related to `client_assertion_type`

**Cause:** The parameter is missing or incorrect.

**Solution:** Set `client_assertion_type` to exactly `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`.

---

### Issuer/subject mismatch

**Error:** `iss` or `sub` validation failure

**Cause:** The `iss` or `sub` claim does not match the `client_id`.

**Solution:** Set both `iss` and `sub` to the `client_id`.

---

## Algorithm and key errors

### Invalid algorithm

**Error:** Related to the JSON Web Token (JWT) algorithm

**Cause:** The client uses an unsupported signing algorithm.

**Solution:** Use one of the supported algorithms: `ES256`, `PS256`, or `EdDSA`. ID Check does NOT support `RS256`, because of FAPI 2.0 requirements.

---

### Key not found

**Error:** Key ID not found

**Cause:** The `kid` in the JWT header doesn't match any registered key.

**Solution:** Make sure that the `kid` matches a key in the client's registered JSON Web Key Set (JWKS).

---

## Audience and configuration errors

### Invalid audience

**Error:** Audience validation failure

**Cause:** The `aud` claim doesn't match the ID Check base URL.

**Solution:** Use the ID Check base URL, not an endpoint URL.

---

## Request object errors

### Missing required claims

**Error:** Missing required claim in request object

**Cause:** The request object is missing one or more required claims.

**Solution:** Make sure that the request object includes all required claims:

- `iss`
- `aud`
- `exp`
- `client_id`
- `response_type`
- `redirect_uri`
- `scope`
- `state`
- `nonce`
- `code_challenge`
- `code_challenge_method`
- `claims`

---

### Invalid redirect_uri

**Error:** Redirect URI validation failure

**Cause:** The `redirect_uri` doesn't match any registered URI for the client.

**Solution:** Use a redirect URI that is registered with ID Check for the client.

---

## Token exchange errors

### Invalid code_verifier

**Error:** Proof Key for Code Exchange (PKCE) verification failure

**Cause:** The `code_verifier` doesn't match the `code_challenge` from the original request.

**Solution:** Use the same `code_verifier` that the client used to generate the `code_challenge` in the pushed authorisation request (PAR).

---

### Authorisation code expired

**Error:** Code has expired

**Cause:** The client did not exchange the authorisation code for tokens within the validity period.

**Solution:** Complete the token exchange promptly after receiving the authorisation code. The code typically expires after a few minutes.

---

## Authorisation callback errors

During the identity verification flow, ID Check may return errors to the client's `redirect_uri` as query parameters. ID Check returns these errors as redirects back to the client application, not directly from the PAR or token endpoints:

```
https://your-app.example.com/callback?error=access_denied&error_description=Session+expired&state=af0ifjsldkj&iss=https%3A%2F%2F{base-url}
```

### Error codes

| Error                     | Description                                                                                                           |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `access_denied`           | The user aborted the verification, the session expired, or identity verification failed (document or biometric check) |
| `server_error`            | An internal error occurred during the verification flow (e.g., session error or ID token generation failure)          |
| `invalid_request`         | A client error occurred during the flow (e.g., invalid request data or consent validation failure)                    |
| `temporarily_unavailable` | The ID Check service is temporarily unavailable. The client can retry the request                                     |

### Handling callback errors

The client application should check for the `error` query parameter on the callback URL before it attempts a token exchange. If `error` is present:

1. Verify that the `iss` parameter matches the expected ID Check issuer URL (RFC 9207)
2. Read the `error` and `error_description` parameters
3. Display an appropriate message to the user
4. For `temporarily_unavailable`, consider retrying the flow after a short delay
5. For `access_denied` due to user abort, allow the user to restart the flow

---

## Need more help?

For an error that this page does not list, contact Stø support with:

1. The complete error message
2. The client_id
3. The request that caused the error (with sensitive values redacted)
