Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Add support for custom callback schemes #92

Merged
merged 9 commits into from
Feb 7, 2024

Conversation

Mino5531
Copy link

This PR adds supports for custom callback schemes during authentication on Windows, by opening a new instance of the application that displays a webview (Microsoft WebView2).

Potential issues?

  • Microsoft WebView2 must be installed or packaged with the app (preinstalled as part of Windows 11 and on some Windows 10 devices but not all) Read more
  • App developers must add the following code snippet to their main function to block the webview window from executing code twice
void main(List<String> args) {
//Add this
  if (runWebViewTitleBarWidget(args)) {
    return;
  }
//---
  runApp(const MyApp());
}
  • Will break the old way of using this library (using http://localhost as the scheme) as there will no longer be a local server that listens for calls

fixes #25
And should also (hopefully) fix #73

@ThexXTURBOXx
Copy link
Owner

Thank you very much for your PR! I will review it probably during the weekend :)
The release will probably be version 4.0.0 then due to the breaking changes, but let's see

Copy link
Owner

@ThexXTURBOXx ThexXTURBOXx left a comment

Choose a reason for hiding this comment

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

Here's a few things to think about or change. Thank you for your valuable PR!

flutter_web_auth_2/example/lib/main.dart Show resolved Hide resolved
flutter_web_auth_2/example/lib/main.dart Show resolved Hide resolved
flutter_web_auth_2/example/pubspec.yaml Outdated Show resolved Hide resolved
flutter_web_auth_2/lib/src/windows.dart Outdated Show resolved Hide resolved
* Fix crash/error when trying to open another window after closing a webview during the same application run
@ThexXTURBOXx ThexXTURBOXx merged commit 25cfa23 into ThexXTURBOXx:master Feb 7, 2024
2 checks passed
@ThexXTURBOXx
Copy link
Owner

Sorry for the late response. I have merged your changes and made sure that the "legacy" way and your new approach are both still callable.
I have also documented everything appropriately and will release 4.0.0-alpha.0 now. Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants