Skip to content

Commit

Permalink
Add extra claims into token creation (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas authored Feb 26, 2021
1 parent fdad850 commit f21fbe5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stream_chat/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def normalize_sort(self, sort=None):
sort_fields.append({"field": k, "direction": v})
return sort_fields

def create_token(self, user_id, exp=None):
payload = {"user_id": user_id}
def create_token(self, user_id, exp=None, **claims):
payload = {**claims, "user_id": user_id}
if exp is not None:
payload["exp"] = exp
return jwt.encode(payload, self.api_secret, algorithm="HS256")
Expand Down

0 comments on commit f21fbe5

Please sign in to comment.