odwyersoftware / azure-ad-verify-token

Verify JWT issued by Azure Active Directory B2C in Python 🐍
Other
23 stars 6 forks source link

User Flow (Policy Name) upper case in settings would cause invalid issuer exception #9

Open DominaTang opened 2 years ago

DominaTang commented 2 years ago

Hi,

Thank you for the package, it's very easy to use. In our application, we compose issuer link by Policy Name which has upper case letter. The code throw exception say the issuer is invalid while validate an access token. For example: azure_ad_issuer= "https://xxxx.b2clogin.com/tfp/xxxx .../B2C_1_SignIn/v2.0/"

if change it to lower case: payload = verify_jwt( token= token_to_verify, valid_audiences=[AZURE_CLIENT_ID], issuer=azure_ad_issuer.lower(), jwks_uri=azure_ad_jwks_uri.lower(), verify=True, ) then everything is good. It'd better change the package code to avoid this trick? Thanks, Domina