test24 / api /auth.py
Niansuh's picture
Upload 22 files
3eec113 verified
raw
history blame
424 Bytes
from fastapi import Depends, HTTPException
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from api.config import APP_SECRET
security = HTTPBearer()
def verify_app_secret(credentials: HTTPAuthorizationCredentials = Depends(security)):
if credentials.credentials != APP_SECRET:
raise HTTPException(status_code=403, detail="Invalid APP_SECRET")
return credentials.credentials