Skip to content

Commit 7fffded

Browse files
committed
Raise exception rather than returning None for interaction timeout
1 parent d524595 commit 7fffded

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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)