Skip to content

Commit

Permalink
medium: switch MediumAuth key id from username to user id
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Aug 14, 2016
1 parent 746dd41 commit af5d836
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions oauth_dropins/medium.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MediumAuth(BaseAuth):
See models.BaseAuth for usage details.
Medium-specific details: implements get() but not urlopen(), http(), or api().
The key name is the username.
The key name is the user id (*not* username).
"""
access_token_str = ndb.StringProperty(required=True)
user_json = ndb.TextProperty()
Expand Down Expand Up @@ -156,8 +156,8 @@ def get(self):
raise

user_json = MediumAuth(access_token_str=access_token).get(API_USER_URL).text
username = json.loads(user_json)['data']['username']
auth = MediumAuth(id=username, access_token_str=access_token, user_json=user_json)
id = json.loads(user_json)['data']['id']
auth = MediumAuth(id=id, access_token_str=access_token, user_json=user_json)
auth.put()

self.finish(auth, state=self.request.get('state'))

0 comments on commit af5d836

Please sign in to comment.