Skip to content

Commit edc06b9

Browse files
committed
Friendly hint for a typical oidc_authority error
1 parent 2d03ad9 commit edc06b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

msal/application.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ def __init__(
511511
# Here the self.authority will not be the same type as authority in input
512512
if oidc_authority and authority:
513513
raise ValueError("You can not provide both authority and oidc_authority")
514+
self._oidc_authority = oidc_authority
514515
try:
515516
authority_to_use = authority or "https://{}/common/".format(WORLD_WIDE)
516517
self.authority = Authority(
@@ -973,6 +974,11 @@ def authorize(): # A controller in a web app
973974
**kwargs))
974975
if "access_token" in response:
975976
response[self._TOKEN_SOURCE] = self._TOKEN_SOURCE_IDP
977+
if ("AADSTS500207" in response.get("error_description", "") and
978+
self._oidc_authority and not self._oidc_authority.endswith("/v2.0")):
979+
response["error_description"] = (
980+
'Did you forget to append "/v2.0" to your oidc_authority? '
981+
+ response["error_description"])
976982
telemetry_context.update_telemetry(response)
977983
return response
978984

0 commit comments

Comments
 (0)