Skip to content

Commit

Permalink
Set algo in jwt decode for deprecation notice (#116)
Browse files Browse the repository at this point in the history
JWT decode without an algorithm is deprecated and throws warning, so we set explicitly to silence warnings.
  • Loading branch information
ferhatelmas authored Jun 8, 2020
1 parent 2000000 commit 3282b95
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions stream/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ def test_token_retrieval(self):
def test_user_session_token(self):
client = stream.connect(self.c.api_key, self.c.api_secret)
token = client.create_user_session_token("user")
payload = jwt.decode(token, self.c.api_secret)
payload = jwt.decode(token, self.c.api_secret, algorithms=["HS256"])
self.assertEqual(payload["user_id"], "user")
token = client.create_user_session_token("user", client="python", testing=True)
payload = jwt.decode(token, self.c.api_secret)
payload = jwt.decode(token, self.c.api_secret, algorithms=["HS256"])
self.assertEqual(payload["client"], "python")
self.assertEqual(payload["testing"], True)

Expand Down Expand Up @@ -1069,7 +1069,9 @@ def test_create_email_redirect(self):
parsed_url = urlparse(redirect_url)
qs = parse_qs(parsed_url.query)

decoded = jwt.decode(qs["authorization"][0], self.c.api_secret)
decoded = jwt.decode(
qs["authorization"][0], self.c.api_secret, algorithms=["HS256"]
)

self.assertEqual(
decoded,
Expand Down

0 comments on commit 3282b95

Please sign in to comment.