fix: survive an unconfigured identity provider

Auth.js refuses to build a provider with no issuer, and that refusal
takes down the whole auth layer — including reading a session that
already exists. A missing or misspelled AUTH_AUTHENTIK_ISSUER would
therefore lock everyone out of an otherwise healthy application, and
explain itself only as a stack trace in the logs.

The provider is now registered only when its three settings are present.
Sessions stay readable either way, and the sign-in page says which
variables are missing instead of offering a button that fails.

Found by the first CI run, which has no .env to inherit from: every
signed-in test failed at once, looking exactly like a broken cookie.
The local suite had been passing on variables Playwright was quietly
inheriting from the development environment — so the E2E server is now
given explicit placeholders rather than whatever happens to be around.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012cSY9pVhZmJUKNN7wf1Myd
This commit is contained in:
2026-09-20 23:41:45 +02:00
co-authored by Claude Opus 5
parent 5f67c46cbb
commit efd91c3e8e
3 changed files with 37 additions and 2 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
import Image from 'next/image';
import { redirect } from 'next/navigation';
import { auth, signIn } from '@/lib/auth';
import { auth, isAuthentikConfigured, signIn } from '@/lib/auth';
export const metadata = { title: 'Connexion — ITA ITO' };
@@ -49,6 +49,16 @@ export default async function LoginPage({
</p>
) : null}
{!isAuthentikConfigured ? (
<p
role="alert"
className="mt-8 rounded-[var(--radius-md)] border border-[var(--danger)] bg-[var(--danger-tint)] px-4 py-3 text-sm text-[var(--danger)]"
>
La connexion n’est pas configurée&nbsp;: <span className="font-mono">AUTH_AUTHENTIK_ID</span>,{' '}
<span className="font-mono">AUTH_AUTHENTIK_SECRET</span> et{' '}
<span className="font-mono">AUTH_AUTHENTIK_ISSUER</span> doivent être renseignés.
</p>
) : (
<form
className="mt-8"
action={async () => {
@@ -65,6 +75,7 @@ export default async function LoginPage({
Se connecter avec {providerName}
</button>
</form>
)}
</div>
</main>
);