Supabase Authentication Flow
Last updated
model Screenshot {
userId String
websiteUrl String
screenshotUrl String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
}import { getSupabaseServerClient } from "@/libs/supabase.server";
import { prismaClient } from "@/prisma/db";
export async function GET() {
const supabase = getSupabaseServerClient();
const supabaseSession = await supabase.auth.getSession();
const session = supabaseSession?.data.session;
/* return error if session is not defined, removed for brevity */
const screenshots = await prismaClient.screenshot.findMany({
where: {
userId: session.user.id
}
})
}