Dao
Dao
CDCloudflare Developers
Created by Dao on 5/21/2024 in #general-help
600010 error in turnstile
Many of my users encounter this error (Non-interactive). With the managed version I encounter it myself and cannot go through the captcha, but for me it works with the non-interactive mode. Here is how I render it in js when I need it:
class CloudflareCaptchaClass{
constructor(){
this.token = null;
}

async waitAndReturnToken(){
let counter = 0;
while(counter < 20){
if(this.token != null){
return this.token;
}
await this.delay(100);
counter++;
}
return null;
}

renderCaptcha(elementNumber){
let sitekey = '0xmykey';
//console.log("rendering with sitekey: " + sitekey);

window.turnstile.render(('#cf-captchacontainer-' + elementNumber), {
sitekey: sitekey,
callback: (token) => {
//console.log(`Challenge Success ${token}`);
this.token = token;
},
'expired-callback': () => {
console.log('Captcha expired');
},
});
}

delay(milliseconds){
return new Promise(resolve => {
setTimeout(resolve, milliseconds);
});
}
}
class CloudflareCaptchaClass{
constructor(){
this.token = null;
}

async waitAndReturnToken(){
let counter = 0;
while(counter < 20){
if(this.token != null){
return this.token;
}
await this.delay(100);
counter++;
}
return null;
}

renderCaptcha(elementNumber){
let sitekey = '0xmykey';
//console.log("rendering with sitekey: " + sitekey);

window.turnstile.render(('#cf-captchacontainer-' + elementNumber), {
sitekey: sitekey,
callback: (token) => {
//console.log(`Challenge Success ${token}`);
this.token = token;
},
'expired-callback': () => {
console.log('Captcha expired');
},
});
}

delay(milliseconds){
return new Promise(resolve => {
setTimeout(resolve, milliseconds);
});
}
}
I create a new class on user pressing a button, then call the render function. When user presses another button to submit, I call waitAndReturnToken. I have no idea what I am doing wrong, I am following the documentation and have ensured the site keys work (afterall, if not it would not work at all, not for some users yes and others not)
31 replies