Skip to content

Commit fff9855

Browse files
committed
Merges remote-tracking branch and fixes #516
2 parents 48a7bd3 + 7fffded commit fff9855

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

msal/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@
3434
from .oauth2cli.oidc import Prompt, IdTokenError
3535
from .token_cache import TokenCache, SerializableTokenCache
3636
from .auth_scheme import PopAuthScheme
37+
38+
# Putting module-level exceptions into the package namespace, to make them
39+
# 1. officially part of the MSAL public API, and
40+
# 2. can still be caught by the user code even if we change the module structure.
41+
from .oauth2cli.oauth2 import BrowserInteractionTimeoutError

msal/oauth2cli/oauth2.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
string_types = (str,) if sys.version_info[0] >= 3 else (basestring, )
2929

3030

31+
class BrowserInteractionTimeoutError(RuntimeError):
32+
pass
33+
3134
class BaseClient(object):
3235
# This low-level interface works. Yet you'll find its sub-class
3336
# more friendly to remind you what parameters are needed in each scenario.
@@ -674,6 +677,8 @@ def _obtain_token_by_browser(
674677
auth_uri_callback=auth_uri_callback,
675678
browser_name=browser_name,
676679
)
680+
if auth_response is None:
681+
raise BrowserInteractionTimeoutError("User did not complete the flow in time")
677682
return self.obtain_token_by_auth_code_flow(
678683
flow, auth_response, scope=scope, **kwargs)
679684

0 commit comments

Comments
 (0)