Created
April 1, 2019 10:59
-
-
Save shangyilim/07fc40d5e96921d73d4d956b4863468a 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('/sendSMS', function (req, res) { | |
const { phoneNumber, recaptchaToken } = req.body; | |
const identityToolkit = google.identitytoolkit({ | |
auth: 'GCP_API_KEY', | |
version: 'v3', | |
}); | |
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
i believe there is a small issue with that code
phoneSessionId
is unidentified