Files
Black-Cyan 3f386e5e38 ✏️
- feature access/refresh tokens auth
2026-06-11 15:59:29 +08:00

20 lines
732 B
Python

import os
from starlette.templating import Jinja2Templates
from passlib.context import CryptContext
from fastapi.security import OAuth2PasswordBearer
import jinja2
SECRET_KEY = os.getenv("SECRET_KEY", "nexhome-dev-secret-key-change-in-production")
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 30
REFRESH_TOKEN_EXPIRE_DAYS = 7
# Disable Jinja2 cache to work around Python 3.14 compatibility issue
_loader = jinja2.FileSystemLoader("templates")
_env = jinja2.Environment(loader=_loader, autoescape=jinja2.select_autoescape(), cache_size=0)
templates = Jinja2Templates(env=_env)
bcrypt_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
oauth2_bearer = OAuth2PasswordBearer(tokenUrl="auth/token", auto_error=False)