-
Notifications
You must be signed in to change notification settings - Fork 405
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
Azure AD v2.0 fails issuer check when creating provider #121
Comments
What does curling the following address return (once you replace your tenantid)?
Also what's in the id token? (sorry for the late reply, was on vacation for the last two weeks) |
@ericchiang, curling https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration, returns https://login.microsoftonline.com/{tenantid}/v2.0. But the actual issuer is https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0, as it is documented here: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-v2-tokens
We need to use tenantId = common in the Oauth URLs and tenantId=9188040d-6c67-4c5b-b112-36a304b66dad to verify id_token to support login via personal accounts. Also, one can use their own tenantId to support only Azure AD Organization. |
@ericchiang, I just also tried using https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0/.well-known/openid-configuration. But this results in the following error: |
What the issuer claim for the returned ID token? This package cares about that. Is it the following?
Per the OpenID Connect spec the issuer returned by the discovery URL has to match the claim in the ID Token
https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata |
FYI your "unable to complete your request" link looks like it's working now.
|
So it looks like if you provide the correct issuer everything will work. |
@ericchiang I think using |
This also fails using Azure AD B2C. Providers are mapped to "user flows" within the B2C tenant. In the example below, Provider URL
Notice that the issuer does not match the Provider URL {
"issuer": "https://myorgb2c.b2clogin.com/4c2f1234-123-4567-7654-123321828afd/v2.0/",
"authorization_endpoint": "https://myorgb2c.b2clogin.com/4c2f1234-123-4567-7654-123321828afd/b2c_1_signup-signin/oauth2/v2.0/authorize",
"token_endpoint": "https://myorgb2c.b2clogin.com/4c2f1234-123-4567-7654-123321828afd/b2c_1_signup-signin/oauth2/v2.0/token",
"end_session_endpoint": "https://myorgb2c.b2clogin.com/4c2f1234-123-4567-7654-123321828afd/b2c_1_signup-signin/oauth2/v2.0/logout",
"jwks_uri": "https://myorgb2c.b2clogin.com/4c2f1234-123-4567-7654-123321828afd/b2c_1_signup-signin/discovery/v2.0/keys",
"response_modes_supported": [
"query",
"fragment",
"form_post"
],
"response_types_supported": [
"code",
"code id_token",
"code token",
"code id_token token",
"id_token",
"id_token token",
"token",
"token id_token"
],
"scopes_supported": [
"openid"
],
"subject_types_supported": [
"pairwise"
],
"id_token_signing_alg_values_supported": [
"RS256"
],
"token_endpoint_auth_methods_supported": [
"client_secret_post",
"client_secret_basic"
],
"claims_supported": [
"name",
"emails",
"given_name",
"idp",
"sub",
"tfp",
"iss",
"iat",
"exp",
"aud",
"acr",
"nonce",
"auth_time"
]
} |
Here's a solution for the issuer mismatch problem: #290 (comment) |
Azure AD v2.0 provides OIDC config via:
https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration
Issuer in the config json is returned as
https://login.microsoftonline.com/{tenantid}/v2.0
As a result
NewProvider()
method fails.The text was updated successfully, but these errors were encountered: