"use client";
import { signIn } from "next-auth/react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { Suspense, useState } from "react";
function authErrorMessage(code: string | null): string | null {
if (!code) return null;
if (code === "Callback") {
return (
"Google could not complete sign-in. Most often: DATABASE_URL in vibn-frontend/.env.local must reach Postgres from " +
"this machine (Coolify internal hostnames only work inside Docker). Use a public host/port, tunnel, or proxy; " +
"then run npx prisma db push. Also confirm NEXTAUTH_URL matches the browser (http://localhost:3000) and " +
"Google redirect URI http://localhost:3000/api/auth/callback/google. Dev check: GET /api/debug/prisma — see terminal for [next-auth] logs."
);
}
if (code === "Configuration") {
return "Auth is misconfigured (check GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, NEXTAUTH_SECRET).";
}
if (code === "AccessDenied") {
return "Access was denied. You may need to be added as a test user if the OAuth app is in testing mode.";
}
return `Sign-in error: ${code}`;
}
const showDevLocalSignIn =
process.env.NODE_ENV === "development" &&
Boolean(process.env.NEXT_PUBLIC_DEV_LOCAL_AUTH_EMAIL?.trim());
export default function NextAuthComponent() {
return (
{subtitle}
Local only: sign in without Google as
{process.env.NEXT_PUBLIC_DEV_LOCAL_AUTH_EMAIL}