You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is simple, as described a while back in #642 -- I would like to use private_key_jwt with Azure, to the same extent that I can with Okta. Granted, a little work-around is needed, as described in #423, and that's fine, but that alone is not sufficient (anymore?).
In particular, it seems that Azure insists there be an x5t value in the header that is the thumbprint of the public key. No problem, I can jam that in there by hacking the openid-client library.
That's obviously a hack, but it demonstrates that there is a simple fix. The question I have is, what's the right way to make it possible to add JWT header values from a design perspective, without being annoying or breaking backward compatibility? Azure needs x5t but would also like to have typ: "JWT" for some reason, despite it working fine without it.
I am using the latest release of openid-client, and the code that I have to set up the passport strategy looks like this:
constmetadata={client_id: clientId,redirect_uris: ['https://example.com/oidc/callback'],response_types: ['code'],post_logout_redirect_uris: ['https://example.com'],id_token_signed_response_alg: signingAlgo||'RS256',token_endpoint_auth_method='private_key_jwt',token_endpoint_auth_signing_alg='RS256'}constprivateKey=awaitjose.importPKCS8(clientKey,'RS256')constjwk=awaitjose.exportJWK(privateKey)jwk.kid=awaitjose.calculateJwkThumbprint(jwk)constjwks={keys: [jwk]}constclient=newissuer.Client(metadata,jwks)conststrategy=newStrategy({
client,passReqToCallback: true,usePKCE: codeChallenge||true,extras: {// Override the node-openid-client default that causes grief for Azure AD// which only wants to receive a single audience value.clientAssertionPayload: {aud: issuerUri,},}},(req,tokenset,userinfo,done)=>{if(issuer.end_session_endpoint){req.session.endSessionUrl=client.endSessionUrl({id_token_hint: tokenset.id_token})}done(null,userinfo)})
In case it matters, the error that Azure returns looks like this:
invalid_client (AADSTS700027: The certificate with identifier used to sign the client assertion is not registered on application.
Let me know what you think about this issue. I'll be happy to code a proper solution and submit a PR, taking any guidance you can offer into account. Thank you.
This discussion was converted from issue #667 on February 29, 2024 22:32.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The issue is simple, as described a while back in #642 -- I would like to use
private_key_jwt
with Azure, to the same extent that I can with Okta. Granted, a little work-around is needed, as described in #423, and that's fine, but that alone is not sufficient (anymore?).In particular, it seems that Azure insists there be an
x5t
value in the header that is the thumbprint of the public key. No problem, I can jam that in there by hacking the openid-client library.That's obviously a hack, but it demonstrates that there is a simple fix. The question I have is, what's the right way to make it possible to add JWT header values from a design perspective, without being annoying or breaking backward compatibility? Azure needs
x5t
but would also like to havetyp: "JWT"
for some reason, despite it working fine without it.I am using the latest release of openid-client, and the code that I have to set up the passport strategy looks like this:
In case it matters, the error that Azure returns looks like this:
Let me know what you think about this issue. I'll be happy to code a proper solution and submit a PR, taking any guidance you can offer into account. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions