toResourceServerHttpResponse

Converts this error of a resource endpoint accessed with an access token (credential, userinfo) to the response to send, with the toOAuth2Error as JSON:

  • invalid_token and invalid_dpop_proof: status 401 with WWW-Authenticate (RFC 6750 3., RFC 9449 7.1)

  • use_dpop_nonce: status 401 with WWW-Authenticate and DPoP-Nonce (RFC 9449 9.)

  • any other error, e.g. the credential errors of OpenID4VCI: status 400, for use_attestation_challenge with OAuth-Client-Attestation-Challenge (OA-ABCA 7.4)

authorizationHeader is the value of the request's Authorization header, whose scheme (DPoP or Bearer) is used for WWW-Authenticate; use_dpop_nonce and invalid_dpop_proof always use DPoP, and a missing header Bearer. WWW-Authenticate carries only the error code, never the description.