Google Identity Toolkit - 密码重置流程中断

Google Identity Toolkit - Password Reset flow is broken

我在我的网站上使用 Google Identity Toolkit(用于网络)已有 2 年多了。最近我发现密码重置流程坏了。当我尝试 "Forgot Password",选中 recaptcha 复选框并单击继续时,出现错误 "Request failed. Please try again."

在控制台中我看到了这个:

[ 28.949s] [identitytoolkit] Error: Invalid JSON string: Password reset email sent successfully.
     Gj @   gitkit.js:254
Ej.addLogRecord @   gitkit.js:254
Zi.log  @   gitkit.js:237
R   @   gitkit.js:254
(anonymous) @   gitkit.js:255
Yc  @   gitkit.js:44
g.dispatchEvent @   gitkit.js:42
tj  @   gitkit.js:247
lj.onReadyStateChangeEntryPoint_    @   gitkit.js:245
lj.onReadyStateChange_  @   gitkit.js:245
XMLHttpRequest.send (async)     
lj.send @   gitkit.js:242
Mj  @   gitkit.js:255
Lj.requestRpEndpoint    @   gitkit.js:256
g.requestRpEndpoint @   gitkit.js:259
(anonymous) @   gitkit.js:4
N   @   gitkit.js:190
Fh  @   gitkit.js:190
Sm  @   gitkit.js:334
(anonymous) @   gitkit.js:335
(anonymous) @   gitkit.js:80
(anonymous) @   gitkit.js:77
Yc  @   gitkit.js:44
g.dispatchEvent @   gitkit.js:42
fd  @   gitkit.js:47
ed.handleClick_ @   gitkit.js:47
Uc  @   gitkit.js:39
Rc  @   gitkit.js:41
Pc.b    @   gitkit.js:37

即使错误显示 "email sent successfully",也没有发送。不知道坏了多久。我昨天才发现。

我正在使用这个脚本:

https://www.gstatic.com/authtoolkit/js/gitkit.js 在我的网站上。

我希望 Google Identity Toolkit 团队的某个人可以对此提供帮助。

更新 1:

服务器端代码:

OobResponse oobResponse = gitkitClient.getOobResponse(request);
OobAction oobAction = oobResponse.getOobAction();

// For DEBUG
logger.info("oobAction : " + oobAction);
String action = request.getParameter("action");
logger.info("action : " + action); // returns null
logger.info("response: " + request.getParameter("response")); // returns a long string
logger.info("responseBody : " + oobResponse.getResponseBody()); // returns {"error": "CAPTCHA_CHECK_FAILED" }
logger.info("email : " + oobResponse.getEmail()); // returns null

// If reset password
if (OobAction.RESET_PASSWORD.equals(oobAction)) {
    Optional<String> forgotPasswordLinkOpt = oobResponse.getOobUrl();               
    String passwordResetLink = forgotPasswordLinkOpt.get();

    sendMailService.sendPasswordResetEmail(oobResponse.getEmail(), passwordResetLink);

    return(oobResponse.getResponseBody());              
}   

oobAction 结果是 null,因此 link 没有被发送。但是 action 的值为 resetPassword。 'responseBody' 回来了 {"error": "CAPTCHA_CHECK_FAILED" }。我需要在最后对 recaptcha 字符串进行一些配置吗?

我正在使用来自 Maven 存储库的 gitkitclient v1.2.7:

https://mvnrepository.com/artifact/com.google.identitytoolkit/gitkitclient

Google 团队在后端解决了这个问题,而我这边没有做任何更改。详情见原问题的评论。