"use client"; import React, { useState } from 'react'; import { useRouter } from 'next/navigation'; const AuthenticationScreen = () => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(''); const router = useRouter(); // ZITADEL configuration const zitadelConfig = { authority: 'https://your-zitadel-instance.com', clientId: 'your-client-id', redirectUri: typeof window !== 'undefined' ? window.location.origin : '', scopes: ['openid', 'profile', 'email'], }; const handleSocialLogin = (provider: string) => { setIsLoading(true); setError(''); try { // In a real implementation, this would redirect to ZITADEL's auth endpoint const authUrl = `${zitadelConfig.authority}/oauth/v2/authorize?` + `client_id=${zitadelConfig.clientId}&` + `redirect_uri=${encodeURIComponent(zitadelConfig.redirectUri)}&` + `response_type=code&` + `scope=${encodeURIComponent(zitadelConfig.scopes.join(' '))}&` + `provider=${provider}`; window.location.href = authUrl; } catch (err) { setError('Failed to initiate login'); console.error('Login error:', err); } finally { setIsLoading(false); } }; const handleEmailLogin = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); setError(''); try { // Mock implementation - in real app you would call your backend or ZITADEL directly localStorage.setItem('authToken', 'dummy-token'); router.push('/dashboard'); } catch (err) { setError('Login failed. Please check your credentials.'); console.error('Login error:', err); } finally { setIsLoading(false); } }; return (
"Errar é Humano."
General Bots
Choose your preferred login method
By continuing, you agree to our Terms of Service and Privacy Policy.