WKWebView - challenge

I have a question very similar to this one, from 5 years ago: https://developer.apple.com/forums/thread/75710

I have a macOS app, in which I have a webview, which loads a login page for the user. The user can log in using an SSO, and the SSO login process might require verifying that a certificate is installed on the user's machine.

The certificate and the user login credentials aren't related to my app in any way. The certificate should be already installed at the Keychain.

My question is related to the function webView(_ webView: WKWebView, didReceive challenge:)

  1. Should I implement this function? As I said, the certificate is not related to my app, so it would be better to let the OS handle the challenge, if possible.

  2. In case I have to implement this function, is there any way for my app to answer this challenge? Any example on how to do it?

Accepted Reply

Should I implement this function? As I said, the certificate is not related to my app, so it would be better to let the OS handle the challenge, if possible.

If the requirement is to authenticate the user with client authentication then typically you would built logic into webView(_ webView: WKWebView, didReceive challenge:) to handle the client authentication.

WKWebView does not have a built in picker for the Keychain like macOS Safari does.

Replies

Should I implement this function? As I said, the certificate is not related to my app, so it would be better to let the OS handle the challenge, if possible.

If the requirement is to authenticate the user with client authentication then typically you would built logic into webView(_ webView: WKWebView, didReceive challenge:) to handle the client authentication.

WKWebView does not have a built in picker for the Keychain like macOS Safari does.