Forked from shangyilim/verify-sms-code-express.js
Last active
September 5, 2020 19:36
-
-
Save skibaalex/b0755062f1ac128ba627ec7ab31a2436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { google } from 'googleapis'; | |
app.post('/verifyCode', function (req, res) { | |
const { smsCodem, sessionIdentifier } = req.body; | |
const identityToolkit = google.identitytoolkit({ | |
auth: 'GCP_API_KEY', | |
version: 'v3', | |
}); | |
//sessionIdentifier comes from when we send the sms message | |
const phoneSessionId = getPhoneSessio(sessionIdentifie) | |
await identityToolkit.relyingparty.verifyPhoneNumber({ | |
code: verificationCode, | |
sessionInfo: phoneSessionId, | |
}); | |
// verification code accepted, update phoneNumberVerified flag in database | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment