2017-06-23 24 views
0

IBM MFP Web SDKと以下のコードを使用して、チャレンジを提出し、IBM MobileFirstサーバーから応答を処理します。サーバーが利用可能なときにうまく動作します。問題は、障害ハンドラが接続に失敗した場合に呼び出されないことです。ライブラリはブラウザコンソールに "Host is not responsive"と表示されます。handleFailureは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); 
} 

答えて

2

HandleFailureクライアントがサーバーからチャレンジを受信して​​応答に失敗した場合にのみ、コールバックが発生します。

サーバが応答しないため、チャレンジハンドラがトリガされることはなく、ハンドルエラーが発生することはありません。

クライアントは、クライアントが保護されたリソースにアクセスしようとしているAPI(例:wlresourcerequest、obtainaccesstoken)でエラーHost is not responsiveを返します。

関連する問題