mirror of
https://github.com/fusion44/blitz_api.git
synced 2026-08-13 11:52:45 +02:00
parent
7b94aac3d8
commit
63c52d2ba7
1 changed files with 5 additions and 2 deletions
|
|
@ -6,11 +6,14 @@ from decouple import config
|
|||
|
||||
JWT_SECRET = config("secret")
|
||||
JWT_ALGORITHM = config("algorithm")
|
||||
JWT_EXPIRY_TIME = config("jwt_expiry_time", default=300.0, cast=float)
|
||||
JWT_EXPIRY_TIME = config("jwt_expiry_time", default=300, cast=int)
|
||||
|
||||
|
||||
def signJWT() -> Dict[str, str]:
|
||||
payload = {"user_id": "admin", "expires": time.time() + JWT_EXPIRY_TIME}
|
||||
payload = {
|
||||
"user_id": "admin",
|
||||
"expires": int(round(time.time() * 1000) + JWT_EXPIRY_TIME),
|
||||
}
|
||||
token = jwt.encode(payload, JWT_SECRET, algorithm=JWT_ALGORITHM)
|
||||
return token_response(token)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue