Skip to content

Commit c687d5b

Browse files
committed
Merge remote-tracking branch 'oauth2cli_github/dev' into o2c
2 parents e94dda5 + ed4c796 commit c687d5b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

msal/oauth2cli/authcode.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ def is_wsl():
4848
def _browse(auth_uri, browser_name=None): # throws ImportError, webbrowser.Error
4949
"""Browse uri with named browser. Default browser is customizable by $BROWSER"""
5050
import webbrowser # Lazy import. Some distro may not have this.
51-
browser_opened = webbrowser.get(browser_name).open(auth_uri)
51+
if browser_name:
52+
browser_opened = webbrowser.get(browser_name).open(auth_uri)
53+
else:
54+
# This one can survive BROWSER=nonexist, while get(None).open(...) can not
55+
browser_opened = webbrowser.open(auth_uri)
5256

5357
# In WSL which doesn't have www-browser, try launching browser with PowerShell
5458
if not browser_opened and is_wsl():

0 commit comments

Comments
 (0)