This commit is contained in:
aaron 2025-03-06 14:39:50 +08:00
parent 78f0e9dd84
commit 61603f1981

View File

@ -15,6 +15,8 @@ def create_access_token(data: dict, expires_delta: Optional[timedelta] = None) -
to_encode.update({"exp": datetime.now(timezone.utc) + expires_delta})
else:
to_encode.update({"exp": datetime.now(timezone.utc) + timedelta(days=180)})
print(to_encode)
encoded_jwt = jwt.encode(to_encode, settings.SECRET_KEY, algorithm="HS256")
return encoded_jwt