Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change in ConsumerBasedOAuth, will break some auth backends.

  • Loading branch information...
commit 111118d445b8e7090fdef61c84e94a2eee1e1153 1 parent 03f5b38
@bacher09 authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 social_auth/backends/__init__.py
View
17 social_auth/backends/__init__.py
@@ -559,14 +559,17 @@ def auth_complete(self, *args, **kwargs):
raise AuthTokenError('Incorrect tokens')
try:
- access_token = self.access_token(token)
+ response = self.get_response(token)
except HTTPError, e:
if e.code == 400:
raise AuthCanceled(self)
else:
raise
+ else:
+ access_token = self.access_token(response)
+
- data = self.user_data(access_token)
+ data = self.user_data(access_token, response)
if data is not None:
data['access_token'] = access_token.to_string()
@@ -610,11 +613,15 @@ def fetch_response(self, request):
"""Executes request and fetchs service response"""
response = urlopen(request.to_url())
return '\n'.join(response.readlines())
+
+ def get_response(self, token):
+ request = self.oauth_request(token, self.ACCESS_TOKEN_URL)
+ return self.fetch_response(request)
+
- def access_token(self, token):
+ def access_token(self, response):
"""Return request for access token value"""
- request = self.oauth_request(token, self.ACCESS_TOKEN_URL)
- return Token.from_string(self.fetch_response(request))
+ return Token.from_string(response)
def user_data(self, access_token, response = None):
"""Loads user data from service"""
Please sign in to comment.
Something went wrong with that request. Please try again.