Skip to content

Commit

Permalink
Overriding tokens method ala Twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
kjoconnor committed Jan 10, 2013
1 parent b8968c8 commit d2b331d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions social_auth/backends/contrib/readability.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ def get_user_id(self, details, response):
"""Returns a unique username to use"""
return response['username']

@classmethod
def tokens(cls, instance):
"""Return the tokens needed to authenticate the access to any API the
service might provide. Readability uses a pair of OAuthToken consisting of
an oauth_token and oauth_token_secret.
instance must be a UserSocialAuth instance.
"""
token = super(ReadabilityBackend, cls).tokens(instance)
if token and 'access_token' in token:
token = dict(tok.split('=')
for tok in token['access_token'].split('&'))
return token


class ReadabilityAuth(ConsumerBasedOAuth):
"""Readability OAuth authentication mechanism"""
Expand Down

0 comments on commit d2b331d

Please sign in to comment.