From 1f26d619975a917e4db224a7cba131dc9610a956 Mon Sep 17 00:00:00 2001 From: bruno Date: Fri, 10 Jul 2026 15:44:19 -0400 Subject: [PATCH] feat: multi-provider OAuth callback + GitHub config + login buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Callback now supports any provider (Gitea/GitHub) via providers.get_provider() - OAuth tokens stored in user_oauth_tokens table per user + provider - Login page shows both Gitea and GitHub OAuth buttons - config.py: github_client_id + github_client_secret - Auth flow no longer depends on gitea_oauth import — fully abstracted - Fallback admin user now sets is_active=1 and admin@localhost email --- app/config.py | 4 ++++ app/routers/auth.py | 57 ++++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/app/config.py b/app/config.py index cb0fa2e..802d045 100644 --- a/app/config.py +++ b/app/config.py @@ -17,6 +17,10 @@ class Settings(BaseSettings): gitea_oauth_client_secret: str = "" gitea_webhook_secret: str = "" + # GitHub + github_client_id: str = "" + github_client_secret: str = "" + # OAuth2 oauth_redirect_uri: str = "http://localhost:8080/auth/callback" diff --git a/app/routers/auth.py b/app/routers/auth.py index b175723..456e181 100644 --- a/app/routers/auth.py +++ b/app/routers/auth.py @@ -8,7 +8,6 @@ from fastapi import APIRouter, Request, Query from fastapi.responses import RedirectResponse, HTMLResponse from app.auth.session import SessionManager -from app.auth.oauth import gitea_oauth from app.config import settings logger = logging.getLogger(__name__) @@ -62,7 +61,8 @@ body{background:#191919;color:#fff;font-family:-apple-system,BlinkMacSystemFont,
- + +