feat(frontend): settings page reads user from V2 Identity; drop dead OAuth callback
- dashboard/settings/page.tsx now resolves the current user via getCurrentUser() (Identity JWT cookie) instead of the Supabase server client; display name comes from Identity's full_name. - Remove src/app/auth/callback/route.ts — the Supabase OAuth code-exchange callback is unreferenced now that auth runs entirely on Identity. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -4,9 +4,9 @@ import { SettingsBilling } from "@/components/dashboard/settings/SettingsBilling
|
||||
import { SettingsNotifications } from "@/components/dashboard/settings/SettingsNotifications";
|
||||
import { SettingsProfile } from "@/components/dashboard/settings/SettingsProfile";
|
||||
import { SettingsSecurity } from "@/components/dashboard/settings/SettingsSecurity";
|
||||
import { getCurrentUser } from "@/lib/auth/session";
|
||||
import { createPageMetadata } from "@/lib/metadata";
|
||||
import { getUserProfile } from "@/lib/profiles";
|
||||
import { createClient } from "@/lib/supabase/server";
|
||||
|
||||
export const metadata: Metadata = createPageMetadata({
|
||||
title: "Settings",
|
||||
@@ -17,16 +17,12 @@ export const metadata: Metadata = createPageMetadata({
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function DashboardSettingsPage() {
|
||||
const supabase = await createClient();
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
// Auth is served by the V2 Identity service (JWT cookie), not Supabase.
|
||||
const user = await getCurrentUser();
|
||||
|
||||
const email = user?.email ?? "";
|
||||
const displayName =
|
||||
typeof user?.user_metadata?.full_name === "string"
|
||||
? user.user_metadata.full_name
|
||||
: null;
|
||||
typeof user?.full_name === "string" ? user.full_name : null;
|
||||
|
||||
const profile = user ? await getUserProfile(user.id) : null;
|
||||
const plan = profile?.plan ?? "free";
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
import { isSupabaseConfigured } from "@/lib/supabase/config";
|
||||
import { createClient } from "@/lib/supabase/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams, origin } = new URL(request.url);
|
||||
const code = searchParams.get("code");
|
||||
const next = searchParams.get("next") ?? "/dashboard";
|
||||
|
||||
if (code && isSupabaseConfigured()) {
|
||||
const supabase = await createClient();
|
||||
const { error } = await supabase.auth.exchangeCodeForSession(code);
|
||||
|
||||
if (!error) {
|
||||
return NextResponse.redirect(`${origin}${next}`);
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.redirect(`${origin}/auth?error=auth_callback_failed`);
|
||||
}
|
||||
Reference in New Issue
Block a user