/** * 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 (

Configure OIDC Provider

Enter your OIDC provider details for single sign-on authentication.

onUpdate('oidcProviderName', e.target.value)} />

Display name for the login button (e.g., "Authentik", "Keycloak", "SSO")

onUpdate('oidcIssuerUrl', e.target.value)} />

The OIDC issuer URL from your identity provider configuration

onUpdate('oidcClientId', e.target.value)} />

The OAuth2 client ID from your OIDC provider

onUpdate('oidcClientSecret', e.target.value)} />

The OAuth2 client secret from your OIDC provider

{testResult && (
{testResult.success ? ( ) : ( )}

{testResult.success ? 'Success' : 'Error'}

{testResult.message}

)}

Configuration Tips

  • • The redirect URI will be: {typeof window !== 'undefined' ? `${window.location.origin}/api/auth/oidc/callback` : '[Your Domain]/api/auth/oidc/callback'}
  • • Configure this redirect URI in your OIDC provider settings
  • • Required scopes: openid, profile, email
); }