feat: add BFF backend scaffold for mobile app
This commit is contained in:
1 parent
03d21f607f
commit
591fd991fa
14 files changed
+462
No files matched your search
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import Depends, Header, HTTPException, status
|
||||
|
||||
from .config import Settings, get_settings
|
||||
|
||||
|
||||
async def require_bearer_token(
|
||||
authorization: str | None = Header(default=None),
|
||||
settings: Settings = Depends(get_settings),
|
||||
) -> None:
|
||||
if not settings.auth_token:
|
||||
return
|
||||
|
||||
expected = f"Bearer {settings.auth_token}"
|
||||
if authorization != expected:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Invalid bearer token",
|
||||
)
|
||||
Reference in new issue
Block a user