Reputation: 31
I use IBM MFP Web SDK and the code below to submit challenge and handle responses from IBM MobileFirst server. It works just fine when the server is available. The problem is that the failure handler is not invoked if it fails to connect. Though the library prints "Host is not responsive" into the browser console.
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);
}
Upvotes: 0
Views: 97
Reputation: 3553
HandleFailure
callback gets triggered only when client receive a challenge from server and fails to answer it.
As the server is unresponsive, the challenge handler never gets triggered and handlefailure wont get called.
Client will return Host is not responsive
error in an API(ex: wlresourcerequest, obtainaccesstoken) where client is trying to access protected resource.
Upvotes: 2