[Python-modules-commits] [python-social-auth] 264/322: Take into account that sometimes API v2.3 returns the old querystring format. Fixes #592
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Dec 24 15:13:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to tag v0.2.10
in repository python-social-auth.
commit a3e180532f26f5efd65092437457b0210e199264
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date: Thu Apr 16 20:34:07 2015 -0300
Take into account that sometimes API v2.3 returns the old querystring format. Fixes #592
---
social/backends/facebook.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/social/backends/facebook.py b/social/backends/facebook.py
index dc10d4c..b887d11 100644
--- a/social/backends/facebook.py
+++ b/social/backends/facebook.py
@@ -70,12 +70,19 @@ class FacebookOAuth2(BaseOAuth2):
raise AuthMissingParameter(self, 'code')
state = self.validate_state()
key, secret = self.get_key_and_secret()
- response = self.get_json(self.ACCESS_TOKEN_URL, params={
+ response = self.request(self.ACCESS_TOKEN_URL, params={
'client_id': key,
'redirect_uri': self.get_redirect_uri(state),
'client_secret': secret,
'code': self.data['code']
})
+ # API v2.3 returns a JSON, according to the documents linked at issue
+ # #592, but it seems that this needs to be enabled(?), otherwise the
+ # usual querystring type response is returned.
+ try:
+ response = response.json()
+ except ValueError:
+ response = parse_qs(response.text)
access_token = response['access_token']
return self.do_auth(access_token, response, *args, **kwargs)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git
More information about the Python-modules-commits
mailing list