0
votes

I am using Worklight 6.2 iOS native framework. I have implemented a custom MyChallengeHandler that subclasses ChallengeHandler, and logging in:

[[WLClient sharedInstance] login:@"SomeRealm" withDelegate:LoginListener];

In ChallengeHandler I can submit success, which calls onSuccess: in LoginListener:

[self submitSuccess:response];

However, I can't submit failure, which I was expecting to call onFailure: in LoginListener. In fact, it looks like there is no effect when calling submitFailure: and onFailure: never gets called in LoginListener.

Also, I don't see a declaration of submitFailure: in WL ChallengeHandler header, it is available only in BaseChallengeHandler.

My main point is, currently it looks like the LoginListener onFailure: method is never called, but there are cases when the handleChallenge: should fail. And LoginListener should get released.

Is this a known issue in Worklight, is there any workaround?

Update 1:

Just found a similar problem for JS client API, which isn't useful for native: Adapter procedure call, reporting an authentication failure

Update 2:

This might be important. I am using Adapter authentication, but in the IBM example there is submitLoginForm:, maybe my issue is for Adapter authentication only.

[self submitAdapterAuthentication:invocationData options:nil]
1
First thing I notice, you wrote ChallangeHandler instead of ChallengeHandler (e not a). Not sure if it's just here or in your real code too...Nathan H
(same for handleChallange instead of handleChallenge)Nathan H
It was typo in the post, it is ChallengeHandler obviously.pirags

1 Answers

0
votes

It's a big vague so far but I will write some possibilities I think of. Let me know if any help, and I will update my answer.

1) Your code above says you use the class ChallangeHandler. I am not sure if the typo is only in StackOverflow or in your real code as well, but the class is ChallengeHandler, with a e.

Same for handleChallange instead of handleChallenge.

2) Did you register your challenge handler somewhere?

[[WLClient sharedInstance] registerChallengeHandler:[[MyChallengeHandler alloc] initWithViewController:self] ];

3) Do you ever get to the success of your LoginListener? And of your challenge handler?

You are correct that the documentation does not mentiond submitFailure - I will look into that.

However in code I wrote, I was able to use this without problems.

@implementation MyChallengeHandler
//...
-(void) onSuccess:(WLResponse *)response {
    NSLog(@"inside challenge success");
    [self.vc.navigationController popViewControllerAnimated:YES];
    [self submitSuccess:response];
}

-(void) onFailure:(WLFailResponse *)response {
    NSLog(@"inside challenge failure");
    [self submitFailure:response];
}