Skip to content

Commit

Permalink
Merge pull request #11 from uc-cdis/fix/exp
Browse files Browse the repository at this point in the history
fix(exp): get exp from refresh token
  • Loading branch information
philloooo authored Mar 17, 2019
2 parents 7a5b658 + d34ec8a commit f3e9e4d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wts/resources/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def refresh_refresh_token(tokens):
refresh_token = tokens["refresh_token"]
id_token = tokens["id_token"]
# TODO: verify signature with authutils
content = jwt.decode(id_token, key=None, options=options)
id_token = jwt.decode(id_token, key=None, options=options)
content = jwt.decode(refresh_token, key=None, options=options)
userid = content["sub"]
for old_token in db.session.query(RefreshToken).filter_by(userid=userid):
flask.current_app.logger.info(
Expand All @@ -75,7 +76,7 @@ def refresh_refresh_token(tokens):
new_token = RefreshToken(
token=refresh_token,
userid=userid,
username=content["context"]["user"]["name"],
username=id_token["context"]["user"]["name"],
jti=content["jti"],
expires=content["exp"],
)
Expand Down

0 comments on commit f3e9e4d

Please sign in to comment.