Spaces:
Runtime error
Runtime error
fix redirect
Browse files
auth.py
CHANGED
|
@@ -57,15 +57,9 @@ async def oauth_redirect_callback(request: Request):
|
|
| 57 |
|
| 58 |
|
| 59 |
async def check_oauth(request: Request, call_next):
|
| 60 |
-
if request.url.path
|
| 61 |
-
"/"
|
| 62 |
-
|
| 63 |
-
"/auth/callback",
|
| 64 |
-
): # not protected
|
| 65 |
-
return await call_next(request)
|
| 66 |
-
if request.session.get("user"): # authenticated
|
| 67 |
-
return await call_next(request)
|
| 68 |
-
return RedirectResponse("/")
|
| 69 |
|
| 70 |
|
| 71 |
def get_app() -> FastAPI:
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
async def check_oauth(request: Request, call_next):
|
| 60 |
+
if request.url.path.startswith("/gradio") and not request.session.get("user"): # protected route but not authenticated
|
| 61 |
+
return RedirectResponse("/")
|
| 62 |
+
return await call_next(request)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
def get_app() -> FastAPI:
|