Hi Medplum I updated jwks uri and I checked that i...
# general
y
Hi Medplum I updated jwks uri and I checked that it fails: The response:
Copy code
resp is HTTP/2.0 400 Bad Request
Content-Length: 84
Cache-Control: no-store, no-cache, must-revalidate
Content-Security-Policy: default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';
Content-Type: application/json; charset=utf-8
Date: Tue, 24 Jan 2023 03:37:36 GMT
Pragma: no-cache
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Ratelimit-Limit: 100
X-Ratelimit-Remaining: 99
X-Ratelimit-Reset: 1674532238
X-Xss-Protection: 1; mode=block

{"error":"invalid_request","error_description":"Invalid client assertion signature"}
r
Thanks @yury.starav ! I'm looking into this. The relevant server code is here, in case you want to look: https://github.com/medplum/medplum/blob/7f93a0b6efa376fd37aaf290c8d500816c5c6e7c/packages/server/src/oauth/token.ts
Just to confirm the JWKS URL: curl --location --request GET 'https://dev.api.foresight.codexhealth.com/v0/ehr/Demo-Organization-hmbj3/.well-known/jwks.json'
y
yes, that's correct
r
So that error message comes if there is a failure of the
jwtVerify()
function (https://github.com/medplum/medplum/blob/7f93a0b6efa376fd37aaf290c8d500816c5c6e7c/packages/server/src/oauth/token.ts#L335-L345) That function is not something we write, but comes from the Jose library (https://github.com/panva/jose/blob/main/docs/functions/jwt_verify.jwtVerify.md#readme)
I'd suggest maybe doing some tests for
jwtVerify()
locally, to make sure that you expect the verification to match properly, and then we can continue debugging from there
y
ok
r
As a sanity check, what are you passing in as the "aud" of your JWT?
This might be a useful tool for debugging the verification: https://jwt.io/
y
181 Views