/** * Component: OIDC Configuration Step * Documentation: documentation/features/audiobookshelf-integration.md */ 'use client'; import { useState } from 'react'; import { Button } from '@/components/ui/Button'; import { Input } from '@/components/ui/Input'; interface OIDCConfigStepProps { oidcProviderName: string; oidcIssuerUrl: string; oidcClientId: string; oidcClientSecret: string; onUpdate: (field: string, value: string) => void; onNext: () => void; onBack: () => void; } export function OIDCConfigStep({ oidcProviderName, oidcIssuerUrl, oidcClientId, oidcClientSecret, onUpdate, onNext, onBack, }: OIDCConfigStepProps) { const [testing, setTesting] = useState(false); const [testResult, setTestResult] = useState<{ success: boolean; message: string; } | null>(null); const testConnection = async () => { setTesting(true); setTestResult(null); try { const response = await fetch('/api/setup/test-oidc', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ issuerUrl: oidcIssuerUrl, clientId: oidcClientId, clientSecret: oidcClientSecret, }), }); const data = await response.json(); if (response.ok && data.success) { setTestResult({ success: true, message: 'OIDC discovery successful! Provider configuration validated.', }); } else { setTestResult({ success: false, message: data.error || 'OIDC discovery failed', }); } } catch (error) { setTestResult({ success: false, message: error instanceof Error ? error.message : 'Connection test failed', }); } finally { setTesting(false); } }; const handleNext = () => { if (!testResult?.success) { setTestResult({ success: false, message: 'Please test the OIDC configuration before proceeding', }); return; } onNext(); }; return (
Enter your OIDC provider details for single sign-on authentication.
Display name for the login button (e.g., "Authentik", "Keycloak", "SSO")
The OIDC issuer URL from your identity provider configuration
The OAuth2 client ID from your OIDC provider
The OAuth2 client secret from your OIDC provider
{testResult.message}
Configuration Tips