···42054205 return errorResponse('invalid_grant', 'Invalid code', 400);
42064206 if (authRequest.client_id !== clientId)
42074207 return errorResponse('invalid_grant', 'Client mismatch', 400);
42084208- if (authRequest.dpop_jkt !== dpop.jkt)
42084208+ // For PAR flow, dpop_jkt is set at PAR time and must match
42094209+ // For direct authorization, dpop_jkt is null and we bind to the token request's DPoP
42104210+ if (authRequest.dpop_jkt !== null && authRequest.dpop_jkt !== dpop.jkt) {
42094211 return errorResponse('invalid_dpop_proof', 'DPoP key mismatch', 400);
42124212+ }
4210421342114214 const parameters = JSON.parse(
42124215 /** @type {string} */ (authRequest.parameters),