import React, { useState } from 'react'; import { View, Text, Image, StyleSheet, TouchableOpacity, ScrollView, Alert } from 'react-native'; import { Auth as ZitadelAuth } from '@zitadel/react'; const AuthenticationScreen = () => { const [isAuthenticated, setIsAuthenticated] = useState(false); const handleLogin = async () => { try { const auth = new ZitadelAuth({ clientId: 'YOUR_CLIENT_ID', issuer: 'YOUR_ZITADEL_ISSUER_URL', redirectUri: 'YOUR_REDIRECT_URI', scopes: ['openid', 'profile', 'email'], }); const result = await auth.authorize(); if (result?.accessToken) { await AsyncStorage.setItem('authToken', result.accessToken); setIsAuthenticated(true); Alert.alert('Login Successful', 'You are now authenticated.'); } else { Alert.alert('Login Failed', 'Unable to retrieve access token.'); } } catch (error) { console.error('Login error:', error); Alert.alert('Login Error', 'An error occurred during login.'); } }; const handleLogout = async () => { try { await AsyncStorage.removeItem('authToken'); setIsAuthenticated(false); Alert.alert('Logout Successful', 'You are now logged out.'); } catch (error) { console.error('Logout error:', error); Alert.alert('Logout Error', 'An error occurred during logout.'); } }; return ( {isAuthenticated ? 'Logout' : 'Login'} {/* Replace with your logo component */} Welcome to General Bots Online "Errar é Humano." General Bots Create an account Enter your email below to create your account By clicking continue, you agree to our Terms of Service and Privacy Policy. ); }; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, scrollContent: { flexGrow: 1, }, imageContainer: { // ... styles for image container }, image: { width: '100%', height: 300, resizeMode: 'cover', }, contentContainer: { flex: 1, padding: 16, }, loginButton: { position: 'absolute', top: 16, right: 16, padding: 8, }, loginButtonText: { color: '#000', }, leftPanel: { // ... styles for left panel }, logoContainer: { flexDirection: 'row', alignItems: 'center', }, logoText: { fontSize: 18, fontWeight: 'bold', }, quoteContainer: { marginTop: 'auto', }, quoteText: { fontSize: 16, marginBottom: 8, }, quoteAuthor: { fontSize: 14, }, formContainer: { // ... styles for form container }, formHeader: { alignItems: 'center', marginBottom: 16, }, formTitle: { fontSize: 24, fontWeight: 'bold', }, formSubtitle: { fontSize: 14, color: '#666', }, termsText: { textAlign: 'center', fontSize: 12, color: '#666', marginTop: 16, }, }); export default AuthenticationScreen;