Closed vivekvpandya closed 8 years ago
Hey @vivekvpandya Very interesting use case.
Can you show me how you are making your calls just so I can show you how to cancel the request for a specific request.
Actually , our app has manage user account screen from where they can change their account details (i.e PATCH on /entity/user ) but this screen is only available to logged in users. So I keep a valid credentials around the app till i did not get 401 for any authorized request. here if PATCH request fails I have simple if condition as shown below :
else if(statusCode == 401){
User *user = [User sharedInstance];
[user clearUserDetails];
DIOSSession *sharedSession = [DIOSSession sharedSession];
sharedSession.signRequests = NO;
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"Please verify login credentials first." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alert show];
}
So if provided credentials are wrong ( as it has been changed by user through the web site) the app is logging out the user and no request should be supplying credentials any more until login is done by user. I hope this scenario helps.
Interesting. Okay. I think this issue is fixed in the 4.x branch because swift is way easier to manage.
Hello Kyle,
As per my understanding the variable signRequest in DIOSSession class allows developer to specify whether to pass credential details with request or not.
So following code will add Authorization header with request is signRequest is YES.
but what if developer wants to disable sending credential temporarily for one request ? by setting signRequest to NO does not remove Authorization header. Or if user has changed the password from website and it has not provide new password in app. So following code fix it for me :
So kindly review this and give your valuable input to this issue.
Thanks !