Skip to content

Commit

Permalink
Update user token model
Browse files Browse the repository at this point in the history
  • Loading branch information
Dusko Bogdanovski committed Oct 4, 2016
1 parent a5ce347 commit 3ff529c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ckanext/oauth2/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def by_user_name(cls, user_name):
sa.Column('user_name', sa.types.UnicodeText, primary_key=True),
sa.Column('access_token', sa.types.UnicodeText),
sa.Column('token_type', sa.types.UnicodeText),
sa.Column('refresh_token', sa.types.UnicodeText),
sa.Column('expires_at', sa.types.UnicodeText),
sa.Column('expires_in', sa.types.UnicodeText)
)

Expand Down
4 changes: 2 additions & 2 deletions ckanext/oauth2/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get_stored_token(self, user_name):
if user_token:
return {
'access_token': user_token.access_token,
'refresh_token': user_token.refresh_token,
'expires_at': user_token.expires_at,
'expires_in': user_token.expires_in,
'token_type': user_token.token_type
}
Expand All @@ -173,7 +173,7 @@ def update_token(self, user_name, token):
# Save the new token
user_token.access_token = token['access_token']
user_token.token_type = token['token_type']
user_token.refresh_token = token['refresh_token']
user_token.expires_at = token['expires_at']
user_token.expires_in = token['expires_in']
model.Session.add(user_token)
model.Session.commit()
Expand Down

0 comments on commit 3ff529c

Please sign in to comment.