Fix session expiry: use config value, increase to 7 days
Deploy Dashboard / deploy (push) Failing after 6m38s
Deploy Dashboard / deploy (push) Failing after 6m38s
- LOGIN was ignoring ACCESS_TOKEN_EXPIRE_MINUTES (hardcoded 15min default) - Pass expires_delta from config in login route - Increase token lifetime from 30min to 7 days
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from pydantic import BaseModel
|
||||
import config
|
||||
@@ -51,7 +52,10 @@ async def login(creds: LoginRequest):
|
||||
headers={"WWW-Authenticate": "Bearer"},
|
||||
)
|
||||
|
||||
access_token = auth.create_access_token(data={"sub": creds.username})
|
||||
access_token = auth.create_access_token(
|
||||
data={"sub": creds.username},
|
||||
expires_delta=timedelta(minutes=config.ACCESS_TOKEN_EXPIRE_MINUTES),
|
||||
)
|
||||
return {
|
||||
"access_token": access_token,
|
||||
"token_type": "bearer",
|
||||
|
||||
Reference in New Issue
Block a user