-
Notifications
You must be signed in to change notification settings - Fork 344
fix: misc fixes #1316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: misc fixes #1316
Conversation
| "client_secret", | ||
| scopes=["foo", "bar"], | ||
| rapt_token="rapt_token", | ||
| enable_reauth_refresh=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in continuation from above comment.
In other words, i would like to understand what should be the expected behaviour of the method for the below test case?
with mock.patch("google.oauth2._client._token_endpoint_request_no_throw") as mock_token_request:
mock_token_request.return_value = (False, _REAUTH_NEEDED_ERROR, False)
with pytest.raises(exceptions.RefreshError) as excinfo:
reauth.refresh_grant(
MOCK_REQUEST,
"token_uri",
"refresh_token",
"client_id",
"client_secret",
scopes=["foo", "bar"],
rapt_token="rapt_token",
enable_reauth_refresh=True,
)
whether RefreshError exception is expected or whether reauth refresh flow (i.e., 354-364) is expected since enable_reauth_refresh=True and reponse_data=_REAUTH_NEEDED_ERROR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clundin25 , please let me know your thoughts on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe in case of reauth needed error, the oauth2 token endpoint always returns a json, in other words, something like mock_token_request.return_value = (False, {"error":_REAUTH_NEEDED_ERROR, ...}, False). The server won't return mock_token_request.return_value = (False, _REAUTH_NEEDED_ERROR, False) as described in the test case you mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. then agree.
|
@arithmetic1728 perhaps |
BEGIN_COMMIT_OVERRIDE
fix: fix "AttributeError: 'str' object has no attribute 'get'"
docs: replacing abc.com with example.com
END_COMMIT_OVERRIDE
Fix reauth logic so it can handle token response where error response is a string instead of dict. Similar issue see #857