Skip to content

BUG: Support ASWebAuthenticationSession login flows on macOS #58

Description

@ottnorml

Browserino works as the default browser for normal http/https links, but it does not currently appear to support macOS ASWebAuthenticationSession login flows.

This causes apps that use system web authentication, such as ChatGPT for macOS, to either fall back to Safari or hang when Browserino is force-declared as supporting authentication sessions.

Environment

  • Browserino: 1.1.16
  • Browserino bundle ID: xyz.alexstrnik.Browserino
  • App used for reproduction: ChatGPT for macOS

macOS:

ProductName:            macOS
ProductVersion:         26.5.1
BuildVersion:           25F80

Steps to reproduce

  1. Set Browserino as the default browser in macOS.
  2. Open ChatGPT for macOS.
  3. Click “Log in”.
  4. Observe the macOS authentication prompt.

Actual behavior

Before patching Browserino’s Info.plist, macOS shows the authentication prompt using Safari instead of Browserino.

The system log contains:

SafariLaunchAgent [...] [com.apple.Safari:AuthenticationSession] Browser does not have ASWebAuthenticationSessionWebBrowserSupportCapabilities in its Info.plist.

Browserino’s Info.plist contains normal http and https URL scheme registrations:

CFBundleURLSchemes = Array {
    http
    https
}

But it does not contain:

ASWebAuthenticationSessionWebBrowserSupportCapabilities

After locally adding the following diagnostic-only key:

<key>ASWebAuthenticationSessionWebBrowserSupportCapabilities</key>
<dict>
    <key>IsSupported</key>
    <true/>
    <key>EphemeralBrowserSessionIsSupported</key>
    <true/>
</dict>

macOS does show the authentication prompt with Browserino instead of Safari. However, after clicking “Open”, nothing happens and the calling app remains stuck in the login flow.

Logs then show that macOS sees the patched capability:

"ASWebAuthenticationSessionWebBrowserSupportCapabilities"={
  "EphemeralBrowserSessionIsSupported"=true,
  "IsSupported"=true
}

and that an authentication session request is enqueued:

SafariLaunchAgent [...] [com.apple.Safari:AuthenticationSession] Enqueued authentication session request: <ASWebAuthenticationSessionRequest ... URL = https://auth.openai.com/... redirect_uri=com.openai.chat://...>

However, Browserino does not appear to load the authentication URL or complete the authentication session.

Additional diagnostics

Browserino does not appear to link against AuthenticationServices.framework:

APP="/Applications/Browserino.app"

otool -L "$APP/Contents/MacOS/Browserino" | grep -i AuthenticationServices
echo $?

Output:

1

Browserino also does not appear to contain relevant AuthenticationServices symbols:

nm -m "/Applications/Browserino.app/Contents/MacOS/Browserino" 2>/dev/null \
  | grep -Ei 'ASWebAuthenticationSession|WebBrowserSession|AuthenticationServices'
echo $?

Output:

1

Expected behavior

Browserino should either:

  1. support macOS ASWebAuthenticationSession login flows properly, or
  2. document that Browserino cannot handle this class of authentication flow and that macOS will fall back to Safari.

Possible implementation requirements

A full fix likely requires more than adding the Info.plist key.

Browserino would probably need to:

  • declare ASWebAuthenticationSessionWebBrowserSupportCapabilities,
  • link against AuthenticationServices.framework,
  • implement ASWebAuthenticationSessionWebBrowserSessionHandling,
  • register a handler with ASWebAuthenticationSessionWebBrowserSessionManager,
  • load the authentication URL,
  • detect the callback URL, and
  • call complete(withCallbackURL:) on the active authentication request.

Simply forwarding the initial authentication URL to another browser may not be sufficient, because macOS appears to expect the registered authentication browser to complete the session and return the callback URL to the originating app.

Notes

This issue is not specific to ChatGPT itself. ChatGPT for macOS is just a convenient reproduction case because it uses a system web authentication flow.

Normal http/https URL handling through Browserino continues to work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions