Skip to content

Commit 3e68838

Browse files
committed
Mention instance_discovery instead of validate_authority in an error message
1 parent d7331f2 commit 3e68838

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

msal/__main__.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,24 @@ def _main():
242242
enable_broker = _input_boolean("Enable broker? It will error out later if your app has not registered some redirect URI")
243243
enable_debug_log = _input_boolean("Enable MSAL Python's DEBUG log?")
244244
enable_pii_log = _input_boolean("Enable PII in broker's log?") if enable_broker and enable_debug_log else False
245+
authority = _select_options([
246+
"https://login.microsoftonline.com/common",
247+
"https://login.microsoftonline.com/organizations",
248+
"https://login.microsoftonline.com/microsoft.onmicrosoft.com",
249+
"https://login.microsoftonline.com/msidlab4.onmicrosoft.com",
250+
"https://login.microsoftonline.com/consumers",
251+
],
252+
header="Input authority (Note that MSA-PT apps would NOT use the /common authority)",
253+
accept_nonempty_string=True,
254+
)
255+
instance_discovery = _input_boolean(
256+
"You input an unusual authority which might fail the Instance Discovery. "
257+
"Now, do you want to perform Instance Discovery on your input authority?"
258+
) if not authority.startswith("https://login.microsoftonline.com") else None
245259
app = msal.PublicClientApplication(
246260
chosen_app["client_id"] if isinstance(chosen_app, dict) else chosen_app,
247-
authority=_select_options([
248-
"https://login.microsoftonline.com/common",
249-
"https://login.microsoftonline.com/organizations",
250-
"https://login.microsoftonline.com/microsoft.onmicrosoft.com",
251-
"https://login.microsoftonline.com/msidlab4.onmicrosoft.com",
252-
"https://login.microsoftonline.com/consumers",
253-
],
254-
header="Input authority (Note that MSA-PT apps would NOT use the /common authority)",
255-
accept_nonempty_string=True,
256-
),
261+
authority=authority,
262+
instance_discovery=instance_discovery,
257263
enable_broker_on_windows=enable_broker,
258264
enable_pii_log=enable_pii_log,
259265
token_cache=global_cache,

msal/authority.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(
100100
"The authority you provided, %s, is not whitelisted. "
101101
"If it is indeed your legit customized domain name, "
102102
"you can turn off this check by passing in "
103-
"validate_authority=False"
103+
"instance_discovery=False"
104104
% authority_url)
105105
tenant_discovery_endpoint = payload['tenant_discovery_endpoint']
106106
else:

0 commit comments

Comments
 (0)