use postgresql

This commit is contained in:
knst-kotov
2021-07-26 08:50:33 +00:00
parent 9648870f39
commit a872ebdf31
5 changed files with 21 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ class Token:
@staticmethod
def encode(user: User, exp: datetime, device: str = "pc") -> str:
payload = {"user_id": user.id, "device": device, "exp": exp, "iat": datetime.utcnow()}
return jwt.encode(payload, JWT_SECRET_KEY, JWT_ALGORITHM).decode("UTF-8")
return jwt.encode(payload, JWT_SECRET_KEY, JWT_ALGORITHM)
@staticmethod
def decode(token: str, verify_exp: bool = True) -> PayLoad: