WKWebView not loading webpage in authorization plugin

I am developing a authorization plugin for mac. i am using SFAuthorizationPluginView as i need a webView(WKWebKit) which will perform webAuthn. But the webview is not rendering the requested webpage( i have stable internet connectio). Is it an expected behaviour for a webview in an authorization plugin?

First off, please submit a code-level support request so that I can share some stuff with you. Once that’s done, we can continue the discussion here in the forums. When you create the request, indicate that you were referred by someone at Apple and make sure to include a link to this thread.

I am developing a authorization plugin for mac. i am using SFAuthorizationPluginView as i need a webView(WKWebKit) which will perform webAuthn. But the webview is not rendering the requested webpage( i have stable internet connectio). Is it an expected behaviour for a webview in an authorization plugin?

The basic question here is "Should WKWebView work inside and SFAuthorizationPluginView?" and my two answers are "Maybe" and "No".

  1. On the "Maybe" side, it's possible that WKWebView simply won't work at all. I'm not aware of any intentional "block" that would specifically block WKWebView from running inside an authorization plugin. However, it's possible that the authorization plugins structure or the pre-login environment would block/break part of WKWebView core architecture, breaking it completely.

  2. On the "No" side, this is not definitely NOT something I would expect to "just work". SFAuthorizationPluginView is an NSObject subclass (it's NOT a view) which which acts as a very narrow "bridge" between the hosting interface and the plugin. It was designed around a very narrow use case, not to provide a "general" bridge into AppKit, so at a minimum I'd expect getting this to work would require significant experimentation and that something might not work at all.

Pulling all that together, here are my suggestions/recommendations:

  • Are you sure this is what you want to do? As I said above, it may be possible to get this working but it's likely to be "tricky" and it certainly won't be easier than doing the interface through AppKit. If your main reason for using WKWebView was that you thought it would make your interface easier, then you shouldn't go down this route at all.

  • You need to figure out exactly what's failing. If you're getting some amount of content to load on screen but it doesn't "work", then that's probably an issue at the "bridge" layer (#2) which you might be able to sort out. If you're not getting any UI to load at all, then then could be a lower layer failure creating a complete "block" (#1). Note that there is significant overlap between those two cases. That is, launching to an empty screen could either mean that the WKWebView could not initialize or it could mean that it did fully initialized but that it never received a message telling it to display.

  • I would start with the simplest possible content for you WKWebView. Probably a single static page or even just a single image. Get the simplest possible case working first before you try and introduce any additional complication.

  • I haven't looked into this in any detail, but I would recommend embedding the WKWebView into your own (probably a custom subclass) NSView object, then using that "outer" NSView as the plugin's target. The ensures WKWebView has a "real" parent subview and also gives you a clear point where you can manipulate how events are routed into WKWebView.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Thanks for the detailed response. l was able to render a webview in WKWebView in SFAuthorizationPluginView. Though there are OS restrictions on the view width.

The whole intent of loading the webview in plugin was to perform a webauthn. But unfortunately the platform authenticator doesn’t work here. The reason may be the inability to add a capability of associated domain (webcredential) that points to the rpid in a bundle target.

WKWebView not loading webpage in authorization plugin
 
 
Q