title: Google reCaptcha: Unable to validate in time
body: <blockquote>
    <p>REQ_PARAM_NAME::validated-captcha<br>
    REQ_PARAM_VALUE::Pair(false,Unable to validate in time. Response is assumed 
    correct. 101781)</p>
  </blockquote>
  
  <p>Why do I get this message from google? </p>
  
  <p>The v2 reCaptcha checkbox is checked before submitting the form, but the server validation returns the above result and is rejected (Salesforce form rejects it).</p>
  
  <p>** EDIT **</p>
  
  <p>The website is a wordpress site. Here is the code I needed to add in the header:</p>
  
  <pre><code>&lt;script src="https://www.google.com/recaptcha/api.js"&gt;&lt;/script&gt; 
  &lt;script&gt; function timestamp() {   var response = document.getElementById("g-recaptcha-response"); if (response == null || response.value.trim() == "") {var elems = JSON.parse(document.getElementsByName("captcha_settings")[0].value);elems["ts"] = JSON.stringify(new Date().getTime());document.getElementsByName("captcha_settings")[0].value = JSON.stringify(elems); } } setInterval(timestamp, 500); 
  &lt;/script&gt;
  </code></pre>
  
  <p>The form has nothing special, but is submitted to Salesforce, so I do not validate the captcha myself:</p>
  
  <pre><code>&lt;form action="https://webto.salesforce.com/servlet/servlet..." method=POST"&gt;
  &lt;input  id="email" maxlength="80" name="email" size="20" type="text" /&gt;
  &lt;input type=hidden name='captcha_settings' value='{"keyname":"LOGIS_CO","fallback":"true","orgId":"00YXZ000000XYZ","ts":""}'&gt;
  &lt;!-- some other fields --&gt;
  &lt;div class="g-recaptcha" data-sitekey="xyz..."&gt;&lt;/div&gt;
  &lt;br&gt;&lt;input type="submit" name="submit"&gt;
  </code></pre>
  
  <p>The resulting message "...<em>Unable to validate in time. Response is assumed correct. 101781</em>)" was given to me by Salesforce support.  So Salesforce form does receive the the posted form and they validate the captcha result.</p>
  
  <p>In the end, Salesforce validates the resulting posted form, and they get that <em>validated-captcha = false, Unable to validate in time. Response is assumed correct. 101781.</em> and they reject the post.  So Salesforce support asked me to check for this captcha error message myself...</p>