TheNetworg / oauth2-azure

Azure AD provider for the OAuth 2.0 Client.
https://packagist.org/packages/thenetworg/oauth2-azure
MIT License
229 stars 108 forks source link

B2C - Issue when Getting JWT Verification Keys #172

Closed wuangyalin closed 1 year ago

wuangyalin commented 1 year ago

Hi There,

I am currently trying the experimental feature B2C to my existing system. I noticed there are two issues in the getJwtVerificationKeys function under the Azure.php file.

  1. The keys returned from my B2C application doesn't include alg attributes so I have to change the code $pkey_object = JWK::parseKey($keyinfo); to $pkey_object = JWK::parseKey($keyinfo, 'RS256'); to default the algorithm.
  2. The $pkey_object returned from the JWK::parseKey method is type of Key so I need to change the code $pkey_array = openssl_pkey_get_details($pkey_object); to $pkey_array = openssl_pkey_get_details($pkey_object->getKeyMaterial());.

After the above change I can get the B2C up and running.

Thanks.

arakonn2000 commented 1 year ago

Many thanks. Really helped me to proceed. +1 to add this change in the next release