Last active
April 1, 2019 10:58
-
-
Save shangyilim/1513282a88a3aaa17b5eef294e72747e 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', | |
}); | |
const response = await identityToolkit.relyingparty.sendVerificationCode({ | |
phoneNumber, | |
recaptchaToken: recaptcha, | |
}); | |
// save sessionInfo into db. You will need this to verify the SMS code | |
const sessionInfo = response.data.sessionInfo; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment