Back

how can i add userName to a phone number login in appwrite

  • 0
  • Auth
  • Web
Biswajitchanda
31 May, 2024, 11:37

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; } }

TL;DR
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.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more