Web Developer
hello i'm trying to make a login / register page but i have this error
Invalid `userId` param: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char.this is my code
Login.js
// LoginScreen.jsimport React, { useState } from 'react';import { View, Text, TextInput, Button, Alert } from 'react-native';import { account } from '../../lib/AppWrite'; // Assurez-vous que l'objet account est correctement importéimport { useNavigation } from '@react-navigation/native';
export default function LoginScreen() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const navigation = useNavigation();
const handleLogin = async () => { try { const session = await account.createSession(email, password); Alert.alert('Success', 'Logged in successfully!'); navigation.navigate('Home'); } catch (error) { Alert.alert('Error', error.message); } };
return ( <View style={{ padding: 20 }}> <Text>Email</Text> <TextInput style={{ borderBottomWidth: 1, marginBottom: 20 }} value={email} onChangeText={setEmail} placeholder="Enter your email" keyboardType="email-address" /> <Text>Password</Text> <TextInput style={{ borderBottomWidth: 1, marginBottom: 20 }} value={password} onChangeText={setPassword} placeholder="Enter your password" secureTextEntry /> <Button title="Login" onPress={handleLogin} /> </View> );}