Skip to content

Commit 00cc722

Browse files
committed
create_token should return a string
1 parent dbc4cc5 commit 00cc722

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

stream_chat/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def create_token(self, user_id, exp=None):
9292
payload = {"user_id": user_id}
9393
if exp is not None:
9494
payload["exp"] = exp
95-
return jwt.encode(payload, self.api_secret, algorithm="HS256")
95+
return jwt.encode(payload, self.api_secret, algorithm="HS256").decode()
9696

9797
def update_app_settings(self, **settings):
9898
return self.patch("app", data=settings)

stream_chat/tests/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def test_update_channel_type(self, client):
4343

4444
def test_create_token(self, client):
4545
token = client.create_token("tommaso")
46+
assert type(token) is str
4647
payload = jwt.decode(token, client.api_secret, algorithms=["HS256"])
4748
assert payload.get("user_id") == "tommaso"
4849

0 commit comments

Comments
 (0)