Skip to content
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

feat(oauth): Show an informative log when OAuthError is raised #2175

Closed
wants to merge 1 commit into from
Closed

Conversation

ykdojo
Copy link

@ykdojo ykdojo commented Jan 14, 2019

This is similar to the way facebook/views.py logs an exception.

This feature was requested on #2142.

Example log:
allauth.socialaccount.providers.oauth.client.OAuthError: Invalid response while obtaining request token from "api.twitter.com". Response content: <?xml version="1.0" encoding="UTF-8"?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors>

This is similar to the way facebook/views.py logs an exception
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.009%) to 94.348% when pulling a0921db on ykdojo:master into db7e0e2 on pennersr:master.

@@ -77,7 +77,9 @@ def _get_request_token(self):
raise OAuthError(
_('Invalid response while obtaining request token'
' from "%s".') % get_token_prefix(
self.request_token_url))
self.request_token_url) +
' Response content: %s' % response.content.decode("utf-8")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content need not be in utf-8 format, you should simply use response.text to have the decoding transparently handled for you.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback

@rraihansaputra
Copy link

hi @ykdojo, are you interested to continue working on this PR? This is an improvement that is sorely needed. It would be a shame for your work to not be continued with a bit of correction..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants