ishaq101's picture
clean init
478dec6
raw
history blame contribute delete
461 Bytes
from config.constant import SecurityConstants
from datetime import datetime, timedelta
from jose import jwt
def create_access_token(data: dict) -> str:
to_encode = data.copy()
expire = datetime.now() + timedelta(
minutes=SecurityConstants.JWT_EXPIRE_MINUTES
)
to_encode.update({"exp": expire})
return jwt.encode(
to_encode,
SecurityConstants.JWT_SECRET_KEY,
algorithm=SecurityConstants.JWT_ALGORITHM,
)