DPoP auth help in pre-req script

Hello,

Abstract: It is possible to generate a DPoP token and proof JWK entirely within Postman’s pre-request script correct?

I must authenticate using DPoP authentication, and I’m tired of manually copy and pasting in the tokens before the actual call. I want it fully automatic so I plan to write a pre-request script to handle this. I believe I require the use of npm “jose” and am pretty sure I have it added via packages. Just want to make sure this is feasible before I waste my time.

Thanks!

1 Like

Yep, it’s definitely possible. Postman’s sandbox now supports the jose package, so you can handle DPoP generation entirely in a pre-request script keypair creation, proof signing, and header injection all included.

You’ll just need to generate or persist a key pair (usually ES256) and use it to sign a JWT containing the required DPoP claims (htu, htm, iat, jti). Postman can then attach that JWT to your DPoP header automatically before sending the request.

Thanks for your help Luke, I will find a way to build this!

1 Like