Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion streamlit_oauth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ def refresh_token(self, token, force=False):
if token.get('refresh_token') is None:
raise Exception("Token is expired and no refresh token is available")
else:
token = asyncio.run(self.client.refresh_token(token.get('refresh_token')))
new_token = asyncio.run(self.client.refresh_token(token.get('refresh_token')))
# Keep the old refresh token if the new one is missing it
if not new_token.get('refresh_token'):
new_token['refresh_token'] = token.get('refresh_token')
token = new_token
return token

def revoke_token(self, token, token_type_hint="access_token"):
Expand Down
1 change: 1 addition & 0 deletions tests/test_oauth_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_refresh_token_expired(monkeypatch):
result = oauth.refresh_token(token)

assert result["access_token"] == "new"
assert "refresh_token" in result


def test_revoke_token(monkeypatch):
Expand Down