Captive network support on macOS

Hi,

Question: Is there a way to detect Captive network and show the UI to authenticate to it from within a third party app/plugin on macOS? I tried using URLSession to detect the presence of captive portal by loading the detection URL http://captive.apple.com/hotspot-detect.html but the task fails with no internet connection error without the delegate getting any calls about redirect or auth challenge. Same behavior with WKWebView when I try to load the detection URL, the provisional navigation simply fails with no internet connection error.

Context: I'm building an Auth plugin to do something before users log in to their mac and it requires internet connectivity. I wanted to let the users connect to a wifi network if they aren't already connected. I got connecting to regular networks working but not the captive networks.

Replies

Is there a way to detect Captive network and show the UI to authenticate to it from within a third party app/plugin on macOS?

No, in general, but also…

I'm building an Auth plugin to do something before users log in …

That’s not going to happen. An authorisation plug-in runs in a very weird context and presenting complicated UI — remember that the captive network UI embeds a full blown web view — is just not feasible in that context.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Thanks for you reply Quinn. I see in the console logs some statements that indicate that the OS is able to detect that there is a redirect when hitting http://captive.apple.com/hotspot-detect.html. Can I at least detect that with URLSession or a lower level networking API or is it a private API? Also just curious whats the difference between the publicly available webview API vs the full blown API that OS uses that can display the captive network UI?

Add a Comment