Can't reset user's password in Google Iden

2019-07-10 00:31发布

问题:

I'm trying to setup my Google Identity Toolkit so users can reset their passwords. I'm following the documentation here: https://developers.google.com/identity/toolkit/web/required-endpoints#send_email_url

I'm using the PHP Gitkit Client outlined here: https://github.com/google/identity-toolkit-php-client/blob/master/src/GitkitClient.php

Specifically the function getOobResults() on line 307 seems to be unhappy for some reason. Here's where I'm at:

  1. User sets up account and logs in successfully
  2. User then logs out and starts to log back in, enters email in and clicks "Forgot password"
  3. reCaptcha is shown, click check box and then hit continue

At this point my 'Send Email URL' endpoint (gitkitEmail.php) is successfully called and the following POST is set to it (dropping the full '&response' param since it goes on for a while):

action=resetPassword&email=xodfebefa%40nada.ltd&challenge&response=03ACgFB9tGlNt2KAGhrVY....

I then take that string and parse it using parse_str(); since getOobResults() is looking for an array. However, response I get back is always:

{
  "response_body": {
    "error": "CAPTCHA_CHECK_FAILED"
  }
}

I searched around but can't find any details on this error. Any help would be appreciated. I don't have a reCaptcha setup anywhere on my site, unsure if this is expecting me to do that and that's why it's failing? Also, I did bump all my code to a production environment and got the same error there as I did on my localhost.