forked from platypush/platypush
Logic for supporting JWT tokens both as bytes and strings [closes #197]
This commit is contained in:
parent
a8064d2add
commit
87b70716c1
1 changed files with 4 additions and 1 deletions
|
@ -191,7 +191,10 @@ class UserManager:
|
|||
'expires_at': expires_at.timestamp() if expires_at else None,
|
||||
}
|
||||
|
||||
return jwt.encode(payload, priv_key, algorithm='RS256').decode()
|
||||
token = jwt.encode(payload, priv_key, algorithm='RS256')
|
||||
if isinstance(token, bytes):
|
||||
token = token.decode()
|
||||
return token
|
||||
|
||||
@staticmethod
|
||||
def validate_jwt_token(token: str) -> Dict[str, str]:
|
||||
|
|
Loading…
Reference in a new issue