Getting error when calling sendVerificationCode.
Tech Stack Used : Nodejs:
async (req, res, next) => {
// #swagger.tags = ['Auth']
// #swagger.description = ' This endpoint allows to create a post'
const { phoneNumber, recaptchaToken } = req.body;
console.log(recaptchaToken);
const identityToolkit = google.identitytoolkit({
auth: process.env.GCP_API_KEY,
version: 'v3',
});
const response = await identityToolkit.relyingparty.sendVerificationCode({
phoneNumber,
recaptchaToken,
});
// save sessionInfo into db. You will need this to verify the SMS code
req.user.sessionInfo=response.data.sessionInfo;
await req.user.save();
res.status(200).json({success:true,data:"Otp sent"});
}
How to resolve this? I have tried every way I know.