Invalid userId: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyph
- 0
- React Native
Bonjour j'ai la même erreur mais je n'arrive pas à la résoudre avec votre réponse pouvez vous m'aider voici mon code : import { Account, Avatars, Client, Databases, ID, Query, Storage, } from "react-native-appwrite"; export const appwriteConfig = { endpoint: 'https://cloud.appwrite.io/v1', platform: '...', projectId: '...', databaseId: '...', userCollectionId: '...', videoCollectionId: '...', storageId:'...'
} // Init your React Native SDK
const client = new Client();
client .setEndpoint(appwriteConfig.endpoint) .setProject(appwriteConfig.projectId) .setPlatform(appwriteConfig.platform);
const account = new Account(client); const storage = new Storage(client); const avatars = new Avatars(client); const databases = new Databases(client);
// Register user export async function createUser(email, password, username) { try { const newAccount = await account.create( ID.unique(), email, password, username );
if (!newAccount) throw Error;
const avatarUrl = avatars.getInitials(username);
await signIn(email, password);
const newUser = await databases.createDocument(
appwriteConfig.databaseId,
appwriteConfig.userCollectionId,
ID.unique(),
{
accountId: newAccount.$id,
email: email,
username: username,
avatar: avatarUrl,
}
);
return newUser;
} catch (error) { throw new Error(error); } } export async function signIn(email, password) { try { const session = await account.createSession(email, password);
return session;
} catch (error) {
console.error("Error creating user: ", error.message, error);
throw new Error(error)
}
}
look at the details for the account.createSession() function
C'est à dire ? Pouvez vous me dire où est mon erreur s'il vous plaît ?
Recommended threads
- Auth working for emulator but not for ph...
hey guys i'm using appwrite for expo react native it is working perfectly for emulator but does not working for physical devices can u explain any one and it is...
- Database column name change makes table ...
Hi, new here! I'm currently building an app where there's a table called "track_sessions" whose column "creator" I wanted to change to "creatorID". However, af...
- SyntaxError: The requested module 'node-...
I am trying to use appwrite functions and in the function i am creating rows but i got this error when i executed the funtion. As i checked docs there TablesDB...