Files
iptv-manager-service/app/main.py
Stefano 749e66e63f
All checks were successful
AWS Deploy on Push / build (push) Successful in 1m28s
Added cognito authentication - Fix 1
2025-05-15 15:33:12 -05:00

21 lines
673 B
Python

from fastapi import FastAPI, Depends, HTTPException
from fastapi.responses import RedirectResponse
from app.cabletv.utils.auth import get_current_user, DOMAIN, CLIENT_ID
app = FastAPI()
@app.get("/")
async def root():
return {"message": "IPTV Updater API"}
@app.get("/protected")
async def protected_route(user = Depends(get_current_user)):
if isinstance(user, RedirectResponse):
return user
return {"message": "Protected content", "user": user['Username']}
@app.get("/auth/callback")
async def auth_callback(code: str):
# Here you would exchange the code for tokens
# For now, just redirect to protected route
return {"auth_code": code}