Skip to content

Commit a734633

Browse files
authored
Merge pull request #443 from AzureAD/authority-error-messages
Descriptive error messages for troubleshooting
2 parents 4fd3f40 + e5b2b72 commit a734633

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

msal/authority.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def __init__(self, authority_url, http_client, validate_authority=True):
109109
raise ValueError(
110110
"Unable to get authority configuration for {}. "
111111
"Authority would typically be in a format of "
112-
"https://login.microsoftonline.com/your_tenant_name".format(
112+
"https://login.microsoftonline.com/your_tenant "
113+
"Also please double check your tenant name or GUID is correct.".format(
113114
authority_url))
114115
logger.debug("openid_config = %s", openid_config)
115116
self.authorization_endpoint = openid_config['authorization_endpoint']
@@ -170,7 +171,10 @@ def tenant_discovery(tenant_discovery_endpoint, http_client, **kwargs):
170171
if 400 <= resp.status_code < 500:
171172
# Nonexist tenant would hit this path
172173
# e.g. https://login.microsoftonline.com/nonexist_tenant/v2.0/.well-known/openid-configuration
173-
raise ValueError("OIDC Discovery endpoint rejects our request")
174+
raise ValueError(
175+
"OIDC Discovery endpoint rejects our request. Error: {}".format(
176+
resp.text # Expose it as-is b/c OIDC defines no error response format
177+
))
174178
# Transient network error would hit this path
175179
resp.raise_for_status()
176180
raise RuntimeError( # A fallback here, in case resp.raise_for_status() is no-op

0 commit comments

Comments
 (0)