Skip to content

Instantly share code, notes, and snippets.

@bibhuticoder
Created May 30, 2021 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibhuticoder/1717d43ec1a3235cc149340a1c232e3e to your computer and use it in GitHub Desktop.
Save bibhuticoder/1717d43ec1a3235cc149340a1c232e3e to your computer and use it in GitHub Desktop.
app.post('/api/verify-token', (req, res) => {
const { otp, request_id } = req.body;
if (!otp) return res.status(400).send({ message: "Otp is required" });
if (!request_id) return res.status(400).send({ message: "Invalid request" });
verifyOtp(request_id, otp, async (result) => {
if (result) {
// ...
res.send({ message: "Success" });
} else {
// ...
return res.status(400).send({ message: `Error verifying OTP` });
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment