Skip to content

Instantly share code, notes, and snippets.

Avatar

Ctibor Laky luckylooke

View GitHub Profile
@luckylooke
luckylooke / recaptcha_fallback.js
Created Aug 21, 2019
Google recaptcha wrapper for grecaptcha.execute() with version 2 fallback.
View recaptcha_fallback.js
function execute(action, callback) {
// create real promise, because execute method does not return the real one
// (missing documentation what actually returns)
const promise = new Promise((resolve, reject) => {
grecaptcha.ready(() =>
grecaptcha.execute(key, { action }).then(token => {
resolve(token);
},
reject)
);
You can’t perform that action at this time.