Skip to content

[flutter_appauth] Add custom browser with user cancellation handling#654

Open
Kuurse wants to merge 3 commits into
MaikuB:masterfrom
Kuurse:addCustomBrowser
Open

[flutter_appauth] Add custom browser with user cancellation handling#654
Kuurse wants to merge 3 commits into
MaikuB:masterfrom
Kuurse:addCustomBrowser

Conversation

@Kuurse
Copy link
Copy Markdown

@Kuurse Kuurse commented May 12, 2026

Completed code from https://github.com/bbvch/flutter_appauth with added examples handling a timeout on the user login as well as user cancellation detection when signing in with an external browser, as discussed in #318 and #613.

Copy link
Copy Markdown
Owner

@MaikuB MaikuB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes. Besides fixing the linter issues, would you be able to make changes that answered my other question? I was testing by making tweaks to this PR and realised the existing ExternalUserAgent.customBrowser is actually insufficient. It maps to CustomBrowserSafari. I found though that user the other ones listed here like CustomBrowserChrome would open those browsers. In other words, the requested changes are to

  • renameExternalUserAgent.customBrowser should be renamed to ExternalUserAgent.customBrowserSafari
  • add ExternalUserAgent.customBrowserChrome, ExternalUserAgent.customBrowserFirefox and ExternalUserAgent.customBrowserOpera, and have those map to CustomBrowserChrome, CustomBrowserFirefox and CustomBrowserOpera respectively
  • the Info.plist file for the example app would need to add the following
	<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>googlechromes</string>
        <string>opera-https</string>
        <string>firefox</string>
    </array>
  • the example app is updated to add scenarios for Chrome, Firefox and Opera

If your time is limited then if you're able to address the linter issues and renameExternalUserAgent.customBrowser to ExternalUserAgent.customBrowserSafari then once done, I'll merge this in and pick up the rest

@Kuurse
Copy link
Copy Markdown
Author

Kuurse commented May 18, 2026

I can look into that, but I want to confirm with you before I start, right now customBrowser opens the default browser even if it points to CustomBrowserSafari, I tested on an iPhone with Firefox set as the default browser and Firefox opens instead of Safari. Isn't that the desired behavior?

@MaikuB
Copy link
Copy Markdown
Owner

MaikuB commented May 18, 2026

That part is fine. My concerns were on relate to naming in various aspects

  • defaultBrowser based on behaviour would arguably be more appropriate. However, this is based on undocumented behaviour
  • leaving it as customBrowser can make it the enum look out of place and raise questions when the other custom browser enum values are other added
  • this plugin acts as a wrapper for the native SDKs. Given the SDK has particular naming conventions already, renaming customBrowser to customBrowserSafari makes it easier to see that there is a translation to CustomBrowserSafari, same applies to the ones for Chrome, Firefox and Opera. The Dart API docs can then link to the relevant AppAuth iOS SDK API docs page alongside a note that an undocumented but confirmed behaviour that it will open the system default browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants