Rank 1: Thread
Hi, I am creating sms based login. I am able to send SMS code to my real number however I am receving this error. I can log the "secret" and i can see it is not missing but appwrite is complaining for it. Here is my code.
// 1) Send OTP (creates user automatically if phone is new) const result= await account.createPhoneToken( ID.unique(), phone); console.log("SMS based login userid:", result.userId);
return result;
}
async function verifySMS(userId, code) { // Completes the phone login with the OTP const secret = String(code).trim(); console.log("SMS secret:", secret); if (!secret) throw new Error('Code is empty'); // Preferred method for phone OTP: if (typeof account.updatePhoneSession === 'function') { await account.updatePhoneSession({ userId, secret }); } else if (typeof account.createSession === 'function') { // Fallback for older SDKs that still accept token session here await account.createSession({ userId, secret }); } else { throw new Error('No suitable session method found in this SDK build'); } }```
My console log is able to print the "secret" but still getting the error. Here is the console log. ``` LOG SMS based login userid: 68b9efa2001babcdc63 LOG SMS secret: 254643 WARN [AppwriteException: Missing required parameter: "secret"]``` I tried with the Mock number and real number.