Skip to content

Commit

Permalink
Only update refresh_token if it was returned in the response (#43)
Browse files Browse the repository at this point in the history
It is not returned with renewals of the id and access token (which the
documentation did not make clear).
  • Loading branch information
tsibley authored Mar 3, 2021
1 parent 6a9a1f0 commit 8ab7653
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pycognito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ def _set_tokens(self, tokens):
AuthenticationResult.
"""
self.verify_token(tokens["AuthenticationResult"]["IdToken"], "id_token", "id")
self.refresh_token = tokens["AuthenticationResult"]["RefreshToken"]
if "RefreshToken" in tokens["AuthenticationResult"]:
self.refresh_token = tokens["AuthenticationResult"]["RefreshToken"]
self.verify_token(
tokens["AuthenticationResult"]["AccessToken"], "access_token", "access"
)
Expand Down

0 comments on commit 8ab7653

Please sign in to comment.