test24 / api /auth.py
Niansuh's picture
Upload 15 files
00a7e34 verified
raw
history blame contribute delete
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