Skip to content

Instantly share code, notes, and snippets.

@shangyilim
Last active April 1, 2019 10:58
Show Gist options
  • Save shangyilim/1513282a88a3aaa17b5eef294e72747e to your computer and use it in GitHub Desktop.
Save shangyilim/1513282a88a3aaa17b5eef294e72747e to your computer and use it in GitHub Desktop.
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