Files
Sankofa/portal/src/app/api/auth/error/page.tsx
defiQUG 28892a4ce4 fix(portal): NextAuth redirect loop and production NEXTAUTH_URL docs
- Remove pages.signIn pointed at API route; normalize redirects for LAN callbacks
- signIn callbackUrl /; auth error page Try Again to /
- Add .env.example; README documents public NEXTAUTH_URL (sankofa.nexus)

Made-with: Cursor
2026-03-26 18:56:56 -07:00

63 lines
2.0 KiB
TypeScript

'use client';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
import { Suspense } from 'react';
function AuthErrorContent() {
const searchParams = useSearchParams();
const error = searchParams.get('error');
const errorMessages: Record<string, string> = {
Configuration: 'There is a problem with the server configuration.',
AccessDenied: 'You do not have permission to sign in.',
Verification: 'The verification token has expired or has already been used.',
Default: 'An error occurred during authentication.',
};
const errorMessage = error && errorMessages[error]
? errorMessages[error]
: errorMessages.Default;
return (
<div className="flex min-h-screen items-center justify-center bg-gray-900">
<div className="text-center max-w-md mx-auto p-8">
<h1 className="text-2xl font-bold text-white mb-4">Authentication Error</h1>
<p className="text-gray-400 mb-2">{errorMessage}</p>
{error && (
<p className="text-sm text-gray-500 mb-6">Error code: {error}</p>
)}
<div className="flex gap-4 justify-center">
<Link
href="/"
className="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors inline-block"
>
Go Home
</Link>
<Link
href="/"
className="px-6 py-3 bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition-colors inline-block"
>
Try Again
</Link>
</div>
</div>
</div>
);
}
export default function AuthErrorPage() {
return (
<Suspense fallback={
<div className="flex min-h-screen items-center justify-center bg-gray-900">
<div className="text-center">
<div className="mb-4 h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-blue-600 mx-auto"></div>
<p className="text-gray-400">Loading...</p>
</div>
</div>
}>
<AuthErrorContent />
</Suspense>
);
}