-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loginpass + Azure - claim validation error for claim "iss" #65
Comments
Can you leave the discovery endpoint URL? In our code: https://github.com/authlib/loginpass/blob/master/loginpass/azure.py#L34 issuer = issuer.replace('{tenantid}', tenant) It is replacing |
@lepture I think I figured out what is wrong, and managed to unblock myself, however, there could be a more sinister issue in there. The docs @ https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc give all the info needed. Basically, what value is used for the issuer = issuer.replace('{tenantid}', tenant) is dependent on what tenant was used for the discovery URL. If you put in However, if you use the But, the issue still persists, since for |
It seems like this is a known issue that's not going to be corrected. See MicrosoftDocs/azure-docs#38427. As an alternative, I made a provider that assumes no OpenID Connect support. E.g. class Microsoft:
NAME = 'microsoft'
OAUTH_CONFIG = {
'api_base_url':
'https://graph.microsoft.com/',
'authorize_url':
'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
'access_token_url':
'https://login.microsoftonline.com/common/oauth2/v2.0/token',
'jwks_uri':
'https://login.microsoftonline.com/common/discovery/v2.0/keys',
'userinfo_endpoint':
'https://graph.microsoft.com/oidc/userinfo',
'client_kwargs': {
'scope': 'openid email profile'
},
} Microsoft recommends not hard-coding the UserInfo endpoint, though. |
@blackdwarf I've improved |
This isn't released yet, right? Edit: Nope I also think it should be a good idea to add some testing to Azure, there isn't nothing related in |
@lepture thanks for the fix! |
What I did?
Installed loginpass using pipenv. Used the example to pull in Google and Azure provider. Tried to log in using Azure provider.
The authorization is below, it is incredibly simple. The rest is boilerplate
loginpass
code.What should happen?
The flow should complete and I should get the
user_info
dumped to the screen.What actually happened?
An error
authlib.jose.errors.InvalidClaimError: invalid_claim: Invalid claim "iss"
is thrown and login does not proceed.What I think is the root cause
I think that
loginpass
is actually using OpenID Connect to get the metadata from the server for Azure, which returns the defaultiss
claim as a template with the{tenant}
placeholder that needs to be replaced with a GUID, in my case a static one (as per https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens). Looking atloginpass
code, specificallyazure.py
at line 30, this should work, but I'm still getting the error.The text was updated successfully, but these errors were encountered: