Spaces:
Running
Running
| from datetime import datetime, timedelta, UTC | |
| from jose import jwt | |
| from app.core.config import settings | |
| ALGORITHM = "HS256" | |
| ACCESS_TOKEN_EXPIRE_MINUTES = 43200 # 30 Days | |
| def create_access_token(data: dict): | |
| to_encode = data.copy() | |
| expire = datetime.now(UTC) + timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES) | |
| to_encode.update({"exp": expire}) | |
| encoded_jwt = jwt.encode(to_encode, settings.JWT_SECRET, algorithm=ALGORITHM) | |
| return encoded_jwt |