BiswajitchandaOriginal post
Rank 1: Thread
i am using appwrite in my project but i can't add the userName to the logged in user i am a bit confused. Here is the code to sending otp and verification
//create account with phone number
async createAccountWithPhone(phoneNumber) {
try {
return await this.account.createPhoneToken(ID.unique(), phoneNumber);
} catch (error) {
console.log("Error::auth.js::createAccountWithPhone :", error);
throw error;
}
}
//verify phone number
async verifyPhoneNumber(userId, otp) {
try {
return await this.account.updatePhoneSession(userId, otp);
} catch (error) {
console.log("Error::auth.js::verifyPhoneNumber :", error);
throw error;
}
}
Summary
Issue: Developer is trying to add userName to a phone number login in the appwrite project but facing confusion. They have included code snippets for sending OTP and verification.
Solution:
1. Add a field for userName in the appwrite project for phone number login.
2. Utilize the created account with phone number function to save the userName along with the phoneNumber.
3. When verifying the phone number, ensure to update the session including the userName data as well.