# Financial-grade API-client (FAPI 2.0)

Een client aanpassen aan het FAPI 2.0 Security Profile: private key JWT, pushed authorization requests en sender-constrained tokens via DPoP.

Requires: fapi

> **Let op:** Beschikbaar met de abonnementen Advanced en Pro.

Wordt een applicatie omgezet naar het **FAPI 2.0 Security Profile**, dan verandert wat haar client moet versturen. Een client die eerder werkte, houdt op te werken: het profiel vervangt het client secret door een ondertekende assertion, vereist dat het autorisatieverzoek eerst via een back channel wordt gepusht, en geeft access tokens uit die aan een sleutel van de client zijn gebonden.

Deze handleiding behandelt alleen de verschillen met de [authorization code flow met PKCE](https://dts-identity.com/nl/docs/quickstarts/oidc-authorization-code.md). Lees die handleiding eerst.

## Wat er verandert

| | Standaardclient | FAPI 2.0-client |
|---|---|---|
| Client-authenticatie | Client secret | Private key JWT, met PS256 ondertekend |
| Autorisatieverzoek | Parameters in de browser-URL | Eerst gepusht, browser krijgt een `request_uri` |
| PKCE | Aanbevolen | Vereist, S256 |
| Access token | `Bearer` | `DPoP`, aan uw sleutel gebonden |
| Tokenverzoeken | Eén aanroep | Twee bij het eerste contact, vanwege de DPoP-nonce |

## Voordat u begint

1. **Genereer een sleutelpaar** voor de client-authenticatie. RSA (2048 bits of meer) of EC op de curve P-256.
2. **Registreer de publieke sleutel** bij de applicatie en schakel die daarna om naar het FAPI 2.0-profiel. De aan te houden volgorde staat onder [Financial-grade API security](https://dts-identity.com/nl/docs/integrations/applications.md#financial-grade-api-security).
3. **Genereer een tweede sleutelpaar** voor de DPoP-proofs. Houd dat gescheiden van de sleutel voor client-authenticatie, zodat elke sleutel precies één taak heeft.
4. **Lees het discovery-document.** Het vermeldt nu ook `pushed_authorization_request_endpoint`, en `dpop_signing_alg_values_supported` noemt de algoritmen die proofs mogen gebruiken.

   ```
   https://<your-domain>/.well-known/openid-configuration
   ```

Geeft de API die uw applicatie aanroept JWT-access tokens uit, stel dan ook het ondertekeningsalgoritme van die API in op PS256. Zie [API's](https://dts-identity.com/nl/docs/integrations/apis.md#resource-indicators-and-tokens).

## 1. Een client assertion opbouwen

Elke aanroep die voorheen het client secret droeg, draagt nu een kortlevend JWT, ondertekend met de private sleutel van uw client-authenticatie. De voorbeelden gebruiken de JOSE-bibliotheek van elke stack: [`jose`](https://www.npmjs.com/package/jose) voor Node.js, [`PyJWT`](https://pypi.org/project/PyJWT/) (met de extra `crypto`) voor Python, Nimbus JOSE + JWT voor Java, `Microsoft.IdentityModel.JsonWebTokens` voor C#, `lestrrat-go/jwx` voor Go, `web-token/jwt-framework` voor PHP en `josekit` voor Rust.

```js tab="Node.js" tab-group="lang"
import * as jose from 'jose';

const ISSUER = 'https://<your-domain>';
const CLIENT_ID = '<your-client-id>';

// Your client-authentication private key, plus the key id shown next to the
// registered key in the Admin Console.
const authKey = await jose.importPKCS8(process.env.CLIENT_AUTH_PRIVATE_KEY, 'PS256');
const KID = '<key-id-from-the-console>';

function clientAssertion() {
  return new jose.SignJWT({ jti: crypto.randomUUID() })
    .setProtectedHeader({ alg: 'PS256', kid: KID, typ: 'JWT' })
    .setIssuer(CLIENT_ID)
    .setSubject(CLIENT_ID)
    .setAudience(ISSUER)          // the issuer identifier, not the endpoint URL
    .setIssuedAt()
    .setExpirationTime('2m')
    .sign(authKey);
}
```

```python tab="Python" tab-group="lang"
import os
import time
import uuid

import jwt

ISSUER = "https://<your-domain>"
CLIENT_ID = "<your-client-id>"

# Your client-authentication private key, plus the key id shown next to the
# registered key in the Admin Console.
AUTH_KEY = os.environ["CLIENT_AUTH_PRIVATE_KEY"]
KID = "<key-id-from-the-console>"

def client_assertion():
    now = int(time.time())
    return jwt.encode(
        {
            "jti": str(uuid.uuid4()),
            "iss": CLIENT_ID,
            "sub": CLIENT_ID,
            "aud": ISSUER,  # the issuer identifier, not the endpoint URL
            "iat": now,
            "exp": now + 120,
        },
        AUTH_KEY,
        algorithm="PS256",
        headers={"kid": KID},
    )
```

```java tab="Java" tab-group="lang"
import com.nimbusds.jose.*;
import com.nimbusds.jose.crypto.RSASSASigner;
import com.nimbusds.jose.jwk.JWK;
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
import java.time.Instant;
import java.util.Date;
import java.util.UUID;

static final String ISSUER = "https://<your-domain>";
static final String CLIENT_ID = "<your-client-id>";

// The key id shown next to the registered key in the Admin Console.
static final String KID = "<key-id-from-the-console>";

static String clientAssertion() throws Exception {
    // Your client-authentication private key
    var authKey = JWK.parseFromPEMEncodedObjects(System.getenv("CLIENT_AUTH_PRIVATE_KEY")).toRSAKey();
    var claims = new JWTClaimsSet.Builder()
        .jwtID(UUID.randomUUID().toString())
        .issuer(CLIENT_ID)
        .subject(CLIENT_ID)
        .audience(ISSUER) // the issuer identifier, not the endpoint URL
        .issueTime(new Date())
        .expirationTime(Date.from(Instant.now().plusSeconds(120)))
        .build();
    var jwt = new SignedJWT(
        new JWSHeader.Builder(JWSAlgorithm.PS256).keyID(KID).type(JOSEObjectType.JWT).build(),
        claims);
    jwt.sign(new RSASSASigner(authKey));
    return jwt.serialize();
}
```

```csharp tab="C#" tab-group="lang"
using System.Security.Cryptography;
using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.IdentityModel.Tokens;

const string Issuer = "https://<your-domain>";
const string ClientId = "<your-client-id>";

// Your client-authentication private key, plus the key id shown next to the
// registered key in the Admin Console.
var authRsa = RSA.Create();
authRsa.ImportFromPem(Environment.GetEnvironmentVariable("CLIENT_AUTH_PRIVATE_KEY"));
var authKey = new RsaSecurityKey(authRsa) { KeyId = "<key-id-from-the-console>" };

string ClientAssertion() => new JsonWebTokenHandler().CreateToken(new SecurityTokenDescriptor
{
    Issuer = ClientId,
    Audience = Issuer, // the issuer identifier, not the endpoint URL
    Claims = new Dictionary<string, object> { ["sub"] = ClientId, ["jti"] = Guid.NewGuid().ToString() },
    Expires = DateTime.UtcNow.AddMinutes(2),
    SigningCredentials = new SigningCredentials(authKey, SecurityAlgorithms.RsaSsaPssSha256), // PS256
});
```

```go tab="Go" tab-group="lang"
import (
	"os"
	"time"

	"github.com/google/uuid"
	"github.com/lestrrat-go/jwx/v2/jwa"
	"github.com/lestrrat-go/jwx/v2/jwk"
	"github.com/lestrrat-go/jwx/v2/jwt"
)

const issuer = "https://<your-domain>"
const clientID = "<your-client-id>"

// Your client-authentication private key, plus the key id shown next to the
// registered key in the Admin Console.
var authKey, _ = jwk.ParseKey([]byte(os.Getenv("CLIENT_AUTH_PRIVATE_KEY")), jwk.WithPEM(true))

const kid = "<key-id-from-the-console>"

func clientAssertion() []byte {
	authKey.Set(jwk.KeyIDKey, kid)
	token, _ := jwt.NewBuilder().
		JwtID(uuid.NewString()).
		Issuer(clientID).
		Subject(clientID).
		Audience([]string{issuer}). // the issuer identifier, not the endpoint URL
		IssuedAt(time.Now()).
		Expiration(time.Now().Add(2*time.Minute)).
		Build()
	signed, _ := jwt.Sign(token, jwt.WithKey(jwa.PS256, authKey))
	return signed
}
```

```php tab="PHP" tab-group="lang"
use Jose\Component\Core\AlgorithmManager;
use Jose\Component\KeyManagement\JWKFactory;
use Jose\Component\Signature\Algorithm\PS256;
use Jose\Component\Signature\JWSBuilder;
use Jose\Component\Signature\Serializer\CompactSerializer;

const ISSUER = 'https://<your-domain>';
const CLIENT_ID = '<your-client-id>';
const KID = '<key-id-from-the-console>';

// Your client-authentication private key, plus the key id shown next to the
// registered key in the Admin Console.
$authKey = JWKFactory::createFromKey(getenv('CLIENT_AUTH_PRIVATE_KEY'));

function clientAssertion($authKey): string {
    $jws = (new JWSBuilder(new AlgorithmManager([new PS256()])))
        ->create()
        ->withPayload(json_encode([
            'jti' => bin2hex(random_bytes(16)),
            'iss' => CLIENT_ID,
            'sub' => CLIENT_ID,
            'aud' => ISSUER, // the issuer identifier, not the endpoint URL
            'iat' => time(),
            'exp' => time() + 120,
        ]))
        ->addSignature($authKey, ['alg' => 'PS256', 'kid' => KID, 'typ' => 'JWT'])
        ->build();
    return (new CompactSerializer())->serialize($jws);
}
```

```rust tab="Rust" tab-group="lang"
use std::env;
use std::time::{Duration, SystemTime};

use josekit::jws::{JwsHeader, PS256};
use josekit::jwt::{self, JwtPayload};
use uuid::Uuid;

const ISSUER: &str = "https://<your-domain>";
const CLIENT_ID: &str = "<your-client-id>";

// The key id shown next to the registered key in the Admin Console.
const KID: &str = "<key-id-from-the-console>";

fn client_assertion() -> String {
    let mut header = JwsHeader::new();
    header.set_key_id(KID);
    header.set_token_type("JWT");

    let mut payload = JwtPayload::new();
    payload.set_jwt_id(Uuid::new_v4().to_string());
    payload.set_issuer(CLIENT_ID);
    payload.set_subject(CLIENT_ID);
    payload.set_audience(vec![ISSUER]); // the issuer identifier, not the endpoint URL
    payload.set_issued_at(&SystemTime::now());
    payload.set_expires_at(&(SystemTime::now() + Duration::from_secs(120)));

    // Your client-authentication private key
    let signer = PS256.signer_from_pem(env::var("CLIENT_AUTH_PRIVATE_KEY").unwrap()).unwrap();
    jwt::encode_with_signer(&payload, &header, &signer).unwrap()
}
```

Twee details bepalen of dit wordt geaccepteerd:

- **`aud` moet de issuer-identifier zijn.** Zonder profiel wordt ook de eindpunt-URL geaccepteerd; onder FAPI 2.0 niet.
- **`alg` moet PS256 zijn.** Het profiel legt het ondertekeningsalgoritme voor de assertions van de applicatie vast.

Stuur de assertion bij elk token- en pushed-authorization-verzoek mee als twee formuliervelden:

```
client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer
client_assertion=<the JWT>
```

## 2. Het autorisatieverzoek pushen

Zet de parameters niet in de browser-URL, maar post ze naar het pushed-authorization-eindpunt. Het antwoord is een eenmalige referentie.

```bash
curl -X POST https://<your-domain>/oauth/par \
  -d client_id=<your-client-id> \
  -d response_type=code \
  -d redirect_uri=https://app.example.com/callback \
  -d scope='openid profile' \
  -d code_challenge=<CODE_CHALLENGE> \
  -d code_challenge_method=S256 \
  -d client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer \
  -d client_assertion=<the JWT>
```

Een geslaagde aanroep antwoordt met `201` en:

```json
{
  "request_uri": "urn:ietf:params:oauth:request_uri:...",
  "expires_in": 60
}
```

- **`redirect_uri` moet altijd worden meegestuurd**, ook wanneer de applicatie er precies één geregistreerd heeft. Het profiel schrapt de mogelijkheid om die weg te laten.
- **PKCE is hier verplicht**, met `code_challenge_method=S256`. Een gepusht verzoek zonder challenge wordt geweigerd.
- De `request_uri` is eenmalig te gebruiken en verloopt binnen een minuut. Push het verzoek op het moment dat de gebruiker wordt doorgestuurd, niet op voorhand.

## 3. De gebruiker naar het autorisatie-eindpunt sturen

De browser-URL draagt nu alleen nog de client id en de referentie:

```
https://<your-domain>/authorize
  ?client_id=<your-client-id>
  &request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3A...
```

Het platform stuurt de gebruiker terug naar uw redirect-URI met `code`, `state` en een `iss`-parameter die de issuer benoemt. **Controleer naast `state` ook `iss`** voordat u verdergaat; dat beschermt tegen een antwoord dat vanaf een andere issuer wordt herhaald.

## 4. Een DPoP-proof aanmaken

Een DPoP-proof is een JWT dat met uw private DPoP-sleutel is ondertekend en de publieke sleutel in zijn header draagt. Het is aan één aanvraag gebonden: de methode en de URL staan erin.

```js tab="Node.js" tab-group="lang"
const dpopKey = await jose.importPKCS8(process.env.DPOP_PRIVATE_KEY, 'ES256');
const dpopPublicJwk = await jose.exportJWK(await jose.importSPKI(process.env.DPOP_PUBLIC_KEY, 'ES256'));

function dpopProof(method, url, nonce) {
  return new jose.SignJWT({ jti: crypto.randomUUID(), htm: method, htu: url, ...(nonce ? { nonce } : {}) })
    .setProtectedHeader({ alg: 'ES256', typ: 'dpop+jwt', jwk: dpopPublicJwk })
    .setIssuedAt()
    .sign(dpopKey);
}
```

```python tab="Python" tab-group="lang"
from cryptography.hazmat.primitives.serialization import load_pem_private_key
from jwt.algorithms import ECAlgorithm

dpop_key = load_pem_private_key(os.environ["DPOP_PRIVATE_KEY"].encode(), password=None)
dpop_public_jwk = ECAlgorithm.to_jwk(dpop_key.public_key(), as_dict=True)

def dpop_proof(method, url, nonce=None):
    claims = {"jti": str(uuid.uuid4()), "htm": method, "htu": url, "iat": int(time.time())}
    if nonce:
        claims["nonce"] = nonce
    return jwt.encode(
        claims, dpop_key,
        algorithm="ES256",
        headers={"typ": "dpop+jwt", "jwk": dpop_public_jwk},
    )
```

```java tab="Java" tab-group="lang"
import com.nimbusds.jose.crypto.ECDSASigner;

static String dpopProof(String method, String url, String nonce) throws Exception {
    var dpopKey = JWK.parseFromPEMEncodedObjects(System.getenv("DPOP_PRIVATE_KEY")).toECKey();

    var claims = new JWTClaimsSet.Builder()
        .jwtID(UUID.randomUUID().toString())
        .claim("htm", method)
        .claim("htu", url)
        .issueTime(new Date());
    if (nonce != null) claims.claim("nonce", nonce);

    var jwt = new SignedJWT(
        new JWSHeader.Builder(JWSAlgorithm.ES256)
            .type(new JOSEObjectType("dpop+jwt"))
            .jwk(dpopKey.toPublicJWK())
            .build(),
        claims.build());
    jwt.sign(new ECDSASigner(dpopKey));
    return jwt.serialize();
}
```

```csharp tab="C#" tab-group="lang"
var dpopEc = ECDsa.Create();
dpopEc.ImportFromPem(Environment.GetEnvironmentVariable("DPOP_PRIVATE_KEY"));
var dpopKey = new ECDsaSecurityKey(dpopEc);
var publicJwk = JsonWebKeyConverter.ConvertFromECDsaSecurityKey(
    new ECDsaSecurityKey(ECDsa.Create(dpopEc.ExportParameters(includePrivateParameters: false))));

string DpopProof(string method, string url, string? nonce = null)
{
    var claims = new Dictionary<string, object> { ["jti"] = Guid.NewGuid().ToString(), ["htm"] = method, ["htu"] = url };
    if (nonce is not null) claims["nonce"] = nonce;

    return new JsonWebTokenHandler().CreateToken(new SecurityTokenDescriptor
    {
        TokenType = "dpop+jwt",
        Claims = claims,
        SigningCredentials = new SigningCredentials(dpopKey, SecurityAlgorithms.EcdsaSha256), // ES256
        AdditionalHeaderClaims = new Dictionary<string, object>
        {
            ["jwk"] = new Dictionary<string, string>
            {
                ["kty"] = publicJwk.Kty, ["crv"] = publicJwk.Crv, ["x"] = publicJwk.X, ["y"] = publicJwk.Y,
            },
        },
    });
}
```

```go tab="Go" tab-group="lang"
import "github.com/lestrrat-go/jwx/v2/jws"

var dpopKey, _ = jwk.ParseKey([]byte(os.Getenv("DPOP_PRIVATE_KEY")), jwk.WithPEM(true))

func dpopProof(method, url, nonce string) []byte {
	dpopPublicJwk, _ := dpopKey.PublicKey()

	builder := jwt.NewBuilder().
		JwtID(uuid.NewString()).
		Claim("htm", method).
		Claim("htu", url).
		IssuedAt(time.Now())
	if nonce != "" {
		builder = builder.Claim("nonce", nonce)
	}
	token, _ := builder.Build()

	headers := jws.NewHeaders()
	headers.Set("typ", "dpop+jwt")
	headers.Set("jwk", dpopPublicJwk)
	signed, _ := jwt.Sign(token, jwt.WithKey(jwa.ES256, dpopKey, jws.WithProtectedHeaders(headers)))
	return signed
}
```

```php tab="PHP" tab-group="lang"
use Jose\Component\Signature\Algorithm\ES256;

$dpopKey = JWKFactory::createFromKey(getenv('DPOP_PRIVATE_KEY'));

function dpopProof($dpopKey, string $method, string $url, ?string $nonce = null): string {
    $claims = ['jti' => bin2hex(random_bytes(16)), 'htm' => $method, 'htu' => $url, 'iat' => time()];
    if ($nonce !== null) {
        $claims['nonce'] = $nonce;
    }
    $jws = (new JWSBuilder(new AlgorithmManager([new ES256()])))
        ->create()
        ->withPayload(json_encode($claims))
        ->addSignature($dpopKey, ['alg' => 'ES256', 'typ' => 'dpop+jwt', 'jwk' => $dpopKey->toPublic()])
        ->build();
    return (new CompactSerializer())->serialize($jws);
}
```

```rust tab="Rust" tab-group="lang"
use josekit::jws::ES256;

fn dpop_proof(method: &str, url: &str, nonce: Option<&str>) -> String {
    let pem = env::var("DPOP_PRIVATE_KEY").unwrap();
    let key_pair = ES256.key_pair_from_pem(&pem).unwrap();

    let mut header = JwsHeader::new();
    header.set_token_type("dpop+jwt");
    header.set_jwk(key_pair.to_jwk_public_key());

    let mut payload = JwtPayload::new();
    payload.set_jwt_id(Uuid::new_v4().to_string());
    payload.set_claim("htm", Some(method.into())).unwrap();
    payload.set_claim("htu", Some(url.into())).unwrap();
    payload.set_issued_at(&SystemTime::now());
    if let Some(nonce) = nonce {
        payload.set_claim("nonce", Some(nonce.into())).unwrap();
    }

    let signer = ES256.signer_from_pem(&pem).unwrap();
    jwt::encode_with_signer(&payload, &header, &signer).unwrap()
}
```

`htu` is de eindpunt-URL zonder query of fragment en moet overeenkomen met de URL die u daadwerkelijk aanroept, inclusief schema en host.

## 5. De code inwisselen, tweemaal

**Er is een servernonce vereist, dus het eerste tokenverzoek mislukt altijd.** Dat hoort zo en is geen fout in uw opzet: het antwoord geeft u een nonce die u in de volgende proof opneemt.

```bash
# First attempt: no nonce yet
curl -i -X POST https://<your-domain>/oauth/token \
  -H 'DPoP: <proof without nonce>' \
  -d grant_type=authorization_code \
  -d code=<one-time-code> \
  -d redirect_uri=https://app.example.com/callback \
  -d code_verifier=<CODE_VERIFIER> \
  -d client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer \
  -d client_assertion=<the JWT>
```

Het antwoord is een `400` met `{"error":"use_dpop_nonce"}` en een `DPoP-Nonce`-antwoordheader. Lees die header uit, bouw een **nieuwe** proof met die waarde als `nonce`-claim en herhaal exact hetzelfde verzoek:

```js tab="Node.js" tab-group="lang"
let res = await tokenRequest(dpopProof('POST', tokenUrl));
if (!res.ok) {
  const nonce = res.headers.get('dpop-nonce');
  res = await tokenRequest(dpopProof('POST', tokenUrl, nonce));
}
```

```python tab="Python" tab-group="lang"
res = token_request(dpop_proof("POST", token_url))
if not res.ok:
    nonce = res.headers.get("dpop-nonce")
    res = token_request(dpop_proof("POST", token_url, nonce))
```

```java tab="Java" tab-group="lang"
var res = tokenRequest(dpopProof("POST", tokenUrl, null));
if (res.statusCode() != 200) {
    var nonce = res.headers().firstValue("DPoP-Nonce").orElseThrow();
    res = tokenRequest(dpopProof("POST", tokenUrl, nonce));
}
```

```csharp tab="C#" tab-group="lang"
var res = await TokenRequest(DpopProof("POST", tokenUrl));
if (!res.IsSuccessStatusCode && res.Headers.TryGetValues("DPoP-Nonce", out var nonces))
{
    res = await TokenRequest(DpopProof("POST", tokenUrl, nonces.First()));
}
```

```go tab="Go" tab-group="lang"
res, _ := tokenRequest(dpopProof("POST", tokenURL, ""))
if res.StatusCode != http.StatusOK {
	nonce := res.Header.Get("DPoP-Nonce")
	res, _ = tokenRequest(dpopProof("POST", tokenURL, nonce))
}
```

```php tab="PHP" tab-group="lang"
$res = tokenRequest(dpopProof($dpopKey, 'POST', $tokenUrl));
if ($res->getStatusCode() !== 200) {
    $nonce = $res->getHeaderLine('DPoP-Nonce');
    $res = tokenRequest(dpopProof($dpopKey, 'POST', $tokenUrl, $nonce));
}
```

```rust tab="Rust" tab-group="lang"
let mut res = token_request(dpop_proof("POST", token_url, None)).await?;
if !res.status().is_success() {
    let nonce = res.headers().get("dpop-nonce").and_then(|v| v.to_str().ok()).map(String::from);
    res = token_request(dpop_proof("POST", token_url, nonce.as_deref())).await?;
}
```

Nonces worden een tijdlang hergebruikt; cache daarom de laatst ontvangen nonce en begin het volgende verzoek daarmee. Verwerk `use_dpop_nonce` op elk moment: verloopt een nonce, dan vindt dezelfde uitwisseling opnieuw plaats.

Een geslaagd antwoord verschilt op één belangrijk punt van een standaardantwoord:

```json
{
  "token_type": "DPoP",
  "access_token": "...",
  "id_token": "...",
  "expires_in": 3600
}
```

## 6. API's aanroepen met het token

`token_type` is `DPoP`, niet `Bearer`, en het token is aan uw DPoP-sleutel gebonden. Elke aanroep van een resource heeft zowel het token als een verse proof voor **die** aanvraag nodig:

```bash
curl https://api.example.com/orders \
  -H 'Authorization: DPoP <access_token>' \
  -H 'DPoP: <proof for GET https://api.example.com/orders>'
```

Het token als `Authorization: Bearer` versturen mislukt. Een resource die de binding controleert, vergelijkt de sleutel in de proof met de confirmation-claim in het token; een gestolen token is daardoor zonder de private sleutel waardeloos.

## Probleemoplossing

- **`use_dpop_nonce` bij elke aanvraag.** De proof mist de `nonce`-claim, of u hebt de vorige proof hergebruikt in plaats van een nieuwe te ondertekenen. Elke proof is eenmalig te gebruiken.
- **`invalid_client`, terwijl dezelfde opzet vóór het profiel werkte.** Ofwel is de `aud` van de assertion de eindpunt-URL in plaats van de issuer-identifier, ofwel is ze met iets anders dan PS256 ondertekend, ofwel komt de `kid` niet overeen met een geregistreerde sleutel.
- **`invalid_dpop_proof`.** De `htu` komt niet overeen met de aangeroepen URL (een proxy die de host herschrijft is een veelvoorkomende oorzaak), of de `htm` komt niet overeen met de methode, of de klok wijkt meer dan een kleine marge af.
- **`invalid_request` bij het autorisatie-eindpunt.** De applicatie vereist een gepusht verzoek, dus parameters kunnen niet meer in de browser-URL worden meegestuurd. Push ze eerst en geef de `request_uri` mee.
- **`request_uri` wordt als onbekend afgewezen.** Ze is al gebruikt of ze is verlopen. Push een nieuw verzoek.
- **De resource wijst het token af.** Controleer of het met het schema `DPoP` wordt verstuurd en of de resource de binding valideert in plaats van een bearer token te verwachten.

## Zie ook

- [Financial-grade API security](https://dts-identity.com/nl/docs/integrations/applications.md#financial-grade-api-security): de applicatie-instellingen en wat het profiel afdwingt.
- [API's](https://dts-identity.com/nl/docs/integrations/apis.md#resource-indicators-and-tokens): het ondertekeningsalgoritme van access tokens.
- [OpenID Connect (Authorization Code + PKCE)](https://dts-identity.com/nl/docs/quickstarts/oidc-authorization-code.md): de basisflow.
