From 795a25961fb070eeeddd1abf63b82636d91cbff3 Mon Sep 17 00:00:00 2001 From: Stefano Date: Thu, 15 May 2025 17:23:52 -0500 Subject: [PATCH] Added cognito authentication - Fix 11 --- app/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index b8daa08..45deb18 100644 --- a/app/main.py +++ b/app/main.py @@ -1,6 +1,5 @@ -from fastapi import FastAPI, Depends, HTTPException +from fastapi import FastAPI, Depends, HTTPException, Request from fastapi.responses import JSONResponse, RedirectResponse -from requests import request from app.cabletv.utils.auth import exchange_code_for_token, get_current_user, DOMAIN, CLIENT_ID app = FastAPI() @@ -16,7 +15,7 @@ async def protected_route(user = Depends(get_current_user)): return {"message": "Protected content", "user": user['Username']} @app.get("/auth/callback") -async def auth_callback(code: str): +async def auth_callback(request: Request, code: str): try: redirect_uri = str(request.base_url) + "auth/callback" tokens = exchange_code_for_token(code, redirect_uri)