[英]handleFailure not called in IBM MobileFirst client?
我使用IBM MFP Web SDK和下面的代碼來提交質詢並處理來自IBM MobileFirst服務器的響應。 當服務器可用時,它可以正常工作。 問題是如果失敗連接失敗,則不會調用失敗處理程序。 盡管該庫在瀏覽器控制台中顯示“主機無響應”。
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中的Host is not responsive
錯誤(例如:wlresourcerequest,gettingaccesstoken)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.