Friday, March 17, 2017

How can I properly implement an authentication challenge using a WKWebView?

Leave a Comment

I'm building a web browser and I'm really novice when it comes to networking.

I'd like to test the code sample bellow but I have no real life example to work with:

- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler {     CFDataRef exceptions = SecTrustCopyExceptions(challenge.protectionSpace.serverTrust);      SecTrustSetExceptions(challenge.protectionSpace.serverTrust, exceptions);      CFRelease(exceptions);      completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); } 

Can anyone provide a URL where I can test the code above?

Edit: I started a bounty because I feel exhausted. I'm in the process of finalizing the application I created and there are so many issues popping up everyday. I'd really appreciate a helping hand!

1 Answers

Answers 1

@Vulkan Please check your code with this link.

http://samvermette.com

I have used this link from https://github.com/TransitApp/SVWebViewController

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment