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
- DB Relational Table Request
Hi, I'd like to suggest a rewording of the relationships between tables. - Current wording: storeOperatingDays can contain one storeId ...
- Domain is already used. Please try again...
I have a website with where the www.domain.me This website works just fine But if I try to visit domain.me. I get this error. I keep getting sent to some app ri...
- Redirect from clicking team invite link ...
Hi all! Pretty new to app development in general so this might be something more generic than appwrite, but I've found (after reading the docs for the Teams API...