-
Notifications
You must be signed in to change notification settings - Fork 57
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 Callback URI Scheme other than http://localhost #25
Comments
I have seen that comment already, but don't think that it will make a lot of sense to implement another temporary solution on top of a current temporary one. |
Ok what i also found out on my Researches are that you can register a scheme in the windows registry. Need to check the native windows api if the programm can do this itself without admin consent. Then the solutuon would be to register the scheme with a native call and assign it to the exe than implement on the start a reaction on the callback and send the data to the server we already create, or change it to a socket solution. |
Ok it is possible to add a registry key without user interaction and without admin rights. This include like already mention a reaction on the callback at the start of the implimentation. I think of a static method call where you give in the callback scheme you want to register and the arguments passed to the application. |
As far as I can remember from my old regedit times, it suffices to add the scheme as a key in
There might be more problems, but these are the two largest one I can think of right now. Maybe I will test a few things in the near future to see if I can get them to work. However, I cannot promise anything since I am in the middle of writing my Master's Thesis at the moment and have to use my spare time to keep all my projects at least somewhat alive. So, bugs can be fixed; enhancements might take longer :) |
I also do some researches in the meantime from what I see it is not necessary to restart the computer or the app to activate the registry. At least for the HKEY_CURRENT_USER hive, which is the one I would use because a normal user can add keys here. |
For instancing we could utilize this one |
I am not sure if I would like to add too many more dependencies to this library. Especially |
Oh, and also there are bug reports like this one: lsegal/flutter_multi_instance_handler#3 |
Good point, the lib isn't big the sharedpref is not needed for windows so i would say we just take what we need. |
Oh didn't seen that, ok than i will take the code an make own researches maybe it is a simple bug but it should be possible to implement. |
The library in itself would be very nice, but it should not have too many (or even better no) dependencies. Then, it might be worth a try |
i was looking around and found this this use win32 package to edit registry for custom url. |
@sumersm7 It looks promising, however, yes, we need to see that it won't break other platforms. |
flutter plugin and platform interface is new for me. make my brain hurt trying to understand. |
We could use win32_registry package the important thing is to only call it in windows cosing so in the correct dart file. The package only uses ffi and win32 like we already does to bring the window to the front. I also tried a little bit around and got the registration working. The thing that is much more complicated is that we get the app to handle the callback correctly because windows will start a new instance of the programm that is customized in the registration |
Using app_links and that specific code from protocol_handler to register scheme , and a conditional import and a empty class with same name so it doesn't get imported in other than window. And nodejs and passport js. I was able to use Oauth login. Let me know if u want more detail about it . It's a jank method but it solves the problem 😅 |
@sumersm7 I am a bit reluctant to replace a jank method (the current one) with another and, thus, add breaking changes. @Mabenan Sounds good for now. If we are able to circumvent opening another instance at some point, I will probably add this or a similar approach. |
|
Hey guys, thanks for maintaining this library. I'm currently implementing a large complex Flutter app with an OAuth2 login flow. I plan to support:
will I be able to support all of these platforms with flutter_web_auth_2 ? I'm a bit confused about Windows support specifically due to this callback URL limitation. |
@mattsrobot Look at the example implementation, it works on all these platforms simultaneously :) |
Do u have any backend server like nodejs, or dart? @mattsrobot If u have a node server u can checkout my flutter code that i tested on Android windows and web. |
@aawssm thank-you kindly! I'm familiar with Node.js I'de love to check it out, much appreciated. |
This is no longer a limitation in |
Hi like i mentioned here appwrite/sdk-for-flutter#96 (comment) I found a potential solution for the callback-uri-scheme.
With this package https://pub.dev/packages/desktop_webview_window we could open a WebView window and call the Auth Url after the login process a URL change to our callback-uri-scheme will happen this can be catched with a registration here
void addOnUrlRequestCallback(OnUrlRequestCallback callback);
.For the transition time i would say that we implement it as an additional feature.
So if a callback-uri-scheme is provided which is not fitting this Constraints
flutter_web_auth_2/flutter_web_auth_2/lib/src/flutter_web_auth_2_windows.dart
Lines 66 to 72 in a844877
Use the in App WebView
If wanted I will provide an PR for this.
The text was updated successfully, but these errors were encountered: