summaryrefslogtreecommitdiff
path: root/Juick/APIClient.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/APIClient.m')
-rw-r--r--Juick/APIClient.m8
1 files changed, 5 insertions, 3 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m
index 848ea77..c7e22cf 100644
--- a/Juick/APIClient.m
+++ b/Juick/APIClient.m
@@ -175,10 +175,12 @@
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler {
if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodHTTPBasic) {
- completionHandler(NSURLSessionAuthChallengeUseCredential, self.credential);
- } else {
- completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
+ if (self.isAuthenticated) {
+ completionHandler(NSURLSessionAuthChallengeUseCredential, self.credential);
+ return;
+ }
}
+ completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
}
-(void) fetchDataWithURL:(NSURL *) url data:(NSData *)postData boundary:(NSString *)boundary callback:(void(^)(NSData *, NSError *))callback {