Let’s see a step-by-step on how to achieve this in Kong.
This example uses Cloundentity as IDP and a client credentials grant type and uses an API service available on the web(ergast.com). Kong is placed in front to authorize the requests and protect the API service. With DPoP, the client must be capable of generating JWTs and signing them with the private key. This example highlights two separate tools. One tool is used to communicate between the client and IDP and another between the client and Kong. You have to ensure to use the same set of keys between the two tools.
Pre-Requisites
- Kong Gateway Enterprise 3.7
- IDP - OIDC and OAuth 2.0 compliant provider supporting DPoP such as Okta, Keycloak, Cloudentity etc
- OAuth2c command line tool to interact with IDP
- Python Program (mentioned here) to generate proof JWTs
(Note it is not necessary to use separate tools. I include it here just for convenience and to showcase the options. #4 can be used to generate proofs for both legs of communication - client to IDP and client to Kong. Alternatively, JWT.io can be used along with a combination of other command line tools such as curl, openssl. ssh-keygen etc )
IDP Configuration
Create a Client with the following with following configuration
a. Grant Type: Client_Credentials
b. Response Types : Token
c. Client Authentication/Token endpoint authentication : Client_Secret Basic
d. Sender Constrained Tokens : DPoP
Kong Configuration
1. Create a Service
a. Name : F1Results
b. Host : ergast.com
c. Path : /api/f1
2. Create a Route for service F!Results
a. Name : drivers
b. Path : /drivers
c. Strip Path : false
3. Add the OIDC plugin with the following settings
a. Issuer : <IDP’s issuer URL>
b. Proof Of Possession DPoP : strict
c. Dpop Proof Lifetime: default is 5 min
In this flow, the client must first obtain the access token from IDP. Since Dpop is enabled, the IDP expects a JWT. We will use OAuth2c to generate proof and interact with IDP.
Steps
- Generate a key pair in the JWKS format
- Using OAuth2c, make a request to IDP to obtain a token. Use the keys generated above

The tool generates a JWT and signs it with the private key as explained in step 2 of the in-depth flow above
3. If all good, IDP returns an access token
4. Now the client must generate a Dpop proof JWT for each request/route. The client must use the same pair of keys and include the access token in this DPoP proof JWT. We will use the python tool to generate the Dpop proof JWT. Pass in the route, method and the access token obtained above to the python program. Use the same set of keys. (The tool expects the keys to be made available in a directory). The tool outputs a JWT.

5. Next, make a request to Kong using the JWT from above and the access token obtained earlier

6. Kong extracts the DPoP proof JWT and the access token from the request. Kong validates the signature using the public key included in the proof. This proves that the client has the private key corresponding to the public key. Next, it checks the public key in the proof JWT matches the public key bound to the access token. This proves that the client is the valid owner of the token
The Proof JWT is valid for 5 min on the same route/method combination. Other routes will require new proof jwt. Requests with just a token or requests with missing or mismatched proofs are rejected.