From b39bce91e4f3627215a6e465dfe5ea16750dbba1 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 15 Jun 2026 14:36:46 +0200 Subject: [PATCH] Remove Apple SSO, keep Google + GitHub only - Removed Apple from OAuth lib (config, exchange, provider type) - Removed Apple button from auth page - Removed Apple tab from setup guide page - Removed Apple env vars from .env, .env.example, docker-compose.yml - Removed Apple prompts from setup-sso.sh --- docker-compose.yml | 2 - scripts/setup-sso.sh | 14 +-- src/app/api/auth/[provider]/callback/route.ts | 23 +---- src/app/api/auth/[provider]/route.ts | 2 +- src/app/auth/page.tsx | 21 ---- src/app/setup/page.tsx | 99 ++----------------- src/lib/oauth.ts | 73 +------------- 7 files changed, 13 insertions(+), 221 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8d7c8a2..60465c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,6 @@ services: - DATABASE_URL=file:./dev.db - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID:-} - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET:-} - - APPLE_CLIENT_ID=${APPLE_CLIENT_ID:-} - - APPLE_CLIENT_SECRET=${APPLE_CLIENT_SECRET:-} - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID:-} - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-} volumes: diff --git a/scripts/setup-sso.sh b/scripts/setup-sso.sh index 0c4a20b..e7a1e6d 100644 --- a/scripts/setup-sso.sh +++ b/scripts/setup-sso.sh @@ -33,19 +33,11 @@ read -sp " Client Secret: " GOOGLE_CLIENT_SECRET echo "" echo "" -# --- Prompt for Apple --- -echo "── 🍎 Apple Sign In ──" -read -p " Service ID : " APPLE_CLIENT_ID -read -sp " Client Secret: " APPLE_CLIENT_SECRET -echo "" -echo "" - # --- Confirm --- echo "═══════════════════════════════════════════════" echo " Summary:" echo " GitHub: ${GITHUB_CLIENT_ID:0:10}..." echo " Google: ${GOOGLE_CLIENT_ID:0:10}..." -echo " Apple: $APPLE_CLIENT_ID" echo "═══════════════════════════════════════════════" read -p "Apply these credentials and redeploy? (y/N) " CONFIRM @@ -56,13 +48,11 @@ fi # --- Backup current .env --- cp "$ENV_FILE" "$ENV_FILE.backup" -echo "✓ Backed up .env → .env.backup" +echo "✓ Backed up .env -> .env.backup" # --- Remove old OAuth lines if they exist --- sed -i '/^GOOGLE_CLIENT_ID=/d' "$ENV_FILE" sed -i '/^GOOGLE_CLIENT_SECRET=/d' "$ENV_FILE" -sed -i '/^APPLE_CLIENT_ID=/d' "$ENV_FILE" -sed -i '/^APPLE_CLIENT_SECRET=/d' "$ENV_FILE" sed -i '/^GITHUB_CLIENT_ID=/d' "$ENV_FILE" sed -i '/^GITHUB_CLIENT_SECRET=/d' "$ENV_FILE" @@ -72,8 +62,6 @@ cat >> "$ENV_FILE" << EOF # --- OAuth / SSO --- GOOGLE_CLIENT_ID="$GOOGLE_CLIENT_ID" GOOGLE_CLIENT_SECRET="$GOOGLE_CLIENT_SECRET" -APPLE_CLIENT_ID="$APPLE_CLIENT_ID" -APPLE_CLIENT_SECRET="$APPLE_CLIENT_SECRET" GITHUB_CLIENT_ID="$GITHUB_CLIENT_ID" GITHUB_CLIENT_SECRET="$GITHUB_CLIENT_SECRET" EOF diff --git a/src/app/api/auth/[provider]/callback/route.ts b/src/app/api/auth/[provider]/callback/route.ts index e5468d0..76f9292 100644 --- a/src/app/api/auth/[provider]/callback/route.ts +++ b/src/app/api/auth/[provider]/callback/route.ts @@ -8,19 +8,19 @@ import { } from "@/lib/oauth"; import { signJWT } from "@/lib/auth"; -const VALID_PROVIDERS = ["google", "apple", "github"]; +const VALID_PROVIDERS = ["google", "github"]; async function handleCallback( req: NextRequest, provider: string ): Promise { try { - // Grab code and state from query params or POST body (Apple uses form_post) + // Grab code and state from query params or POST body const url = new URL(req.url); let code = url.searchParams.get("code"); let stateParam = url.searchParams.get("state"); - // Apple may POST form data — try reading POST body + // Try reading POST body if code wasn't in query params if (!code) { try { const contentType = req.headers.get("content-type") || ""; @@ -138,20 +138,3 @@ export async function GET( } return handleCallback(req, provider); } - -/** Apple OAuth may use form_post response_mode, which sends a POST. */ -export async function POST( - req: NextRequest, - { params }: { params: Promise<{ provider: string }> } -) { - const { provider } = await params; - if (!VALID_PROVIDERS.includes(provider)) { - return NextResponse.json( - { - error: `Unsupported provider. Must be one of: ${VALID_PROVIDERS.join(", ")}`, - }, - { status: 400 } - ); - } - return handleCallback(req, provider); -} diff --git a/src/app/api/auth/[provider]/route.ts b/src/app/api/auth/[provider]/route.ts index 21af93b..4d0dba6 100644 --- a/src/app/api/auth/[provider]/route.ts +++ b/src/app/api/auth/[provider]/route.ts @@ -7,7 +7,7 @@ import { buildAuthorizationUrl, } from "@/lib/oauth"; -const VALID_PROVIDERS = ["google", "apple", "github"]; +const VALID_PROVIDERS = ["google", "github"]; export async function GET( _req: NextRequest, diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx index 691e35e..0146d36 100644 --- a/src/app/auth/page.tsx +++ b/src/app/auth/page.tsx @@ -32,15 +32,6 @@ function GoogleLogo({ className }: { className?: string }) { ); } -/** Inline Apple SVG logo */ -function AppleLogo({ className }: { className?: string }) { - return ( - - - - ); -} - /** Inline GitHub SVG logo */ function GitHubLogo({ className }: { className?: string }) { return ( @@ -141,18 +132,6 @@ export default function AuthPage() { - {/* Apple */} - - {/* GitHub */}