Last active
June 15, 2022 12:53
-
-
Save shangyilim/af185e69e8a0de4e754c3e4908f9f922 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
// set-up an invisible recaptcha. 'sendCode` is button element id | |
// <button id="sendCode">Send Code</button> | |
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sendCode', { | |
'size': 'invisible', | |
'callback': function (recapchaToken) { | |
// reCAPTCHA solved, send recapchaToken and phone number to backend. | |
// a REST call to your backend | |
request.post({ | |
url: 'https://your-rest-api', | |
body: { | |
phoneNumber: document.getElementById('phoneNumber').value, | |
recapchaToken, | |
} | |
}); | |
} | |
}); | |
// render the rapchaVerifier. | |
window.recaptchaVerifier.render().then(function (widgetId) { | |
window.recaptchaWidgetId = widgetId; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do I need to put this code?