handleFailure 未在 IBM MobileFirst 客户端中调用?

handleFailure not called in IBM MobileFirst client?

我使用 IBM MFP Web SDK 和下面的代码提交质询并处理来自 IBM MobileFirst 服务器的响应。当服务器可用时,它工作得很好。问题是如果连接失败,则不会调用失败处理程序。尽管库将 "Host is not responsive" 打印到浏览器控制台。

onInit() {
  this.authHandler = WL.Client.createSecurityCheckChallengeHandler(CHECK_NAME);
  this.authHandler.handleChallenge = this.onChallenge;
  this.authHandler.handleSuccess = this.onSuccess;
  this.authHandler.handleFailure = this.onFailure;
};

onChallenge = () => {
  // display the challenge form...
};

onSuccess = (data) => {
  console.log(data)
};

onFailure = (error) => {
  console.log(error.failure || error.errorMsg || 'Failed to login');
};

login(username: string, password: string): void {
  let data = {
    username: username,
    password: password
  };
  this.authHandler.submitChallengeAnswer(data);
}

HandleFailure回调仅在客户端收到来自服务器的质询且未能回答时触发。

由于服务器没有响应,挑战处理程序永远不会被触发,handlefailure 也不会被调用。

客户端将在 API(例如:wlresourcerequest、obtainaccesstoken)中尝试访问受保护资源时出现 return Host is not responsive 错误。