Permalink
Browse files

Memoize teh whole access token response. Useful if we want access to …

…the refresh token, or the endpoint already returns user credentials
  • Loading branch information...
1 parent d2831cb commit fb84572d6cb6f4d46c963bd163d73837768cfcb1 @flashingpumpkin committed Feb 24, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 socialregistration/clients/oauth.py
@@ -209,6 +209,9 @@ class OAuth2(Client):
# The access token we obtained
_access_token = None
+ # The dict holding all infos we got from the access token endpoint
+ access_token_dict = None
+
# Memoized user info fetched once an access token was obtained
_user_info = None
@@ -282,9 +285,9 @@ def get_access_token(self, code=None, **params):
if code is None:
raise ValueError(_('Invalid code.'))
- access_token_dict = self._get_access_token(code, **params)
+ self.access_token_dict = self._get_access_token(code, **params)
try:
- self._access_token = access_token_dict['access_token']
+ self._access_token = self.access_token_dict['access_token']
except KeyError, e:
raise OAuthError("Credentials could not be validated, the provider returned no access token.")

0 comments on commit fb84572

Please sign in to comment.