MukeshKapoor25's picture
Add initial implementation of User Management Service
b407a42
raw
history blame
425 Bytes
## bookmyservice-ums/app/utils/jwt.py
from jose import jwt
from datetime import datetime, timedelta
SECRET_KEY = "secret-key-placeholder"
ALGORITHM = "HS256"
def create_access_token(data: dict, expires_minutes: int = 60):
to_encode = data.copy()
expire = datetime.utcnow() + timedelta(minutes=expires_minutes)
to_encode.update({"exp": expire})
return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)