-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Implemented deep link and local server options instead web_auth #74
base: master
Are you sure you want to change the base?
Conversation
Added an option for the callback strategy to force external application (browser) opening if possible. |
Thank you for your support. Will take a look soon. |
Hi @TheOnlyBeardedBeast , I apologize for the delayed response and appreciate your contribution. I've initiated a new PR to upgrade our Dart SDK to utilize the most recent flutter_web_auth_2 package. This change will resolve the majority of our platform compatibility issues, including support web applications. Also because, it is more straightforward and easy to integrate for most of the use cases Please check PR #76 . Your concept is truly innovative, and we would love to offer developers greater flexibility in managing authentication redirections. I recommend developing a new client package, distinct from the existing Looking forward to hearing back from you. Thanks. |
@simeng-li Hi, thanks for the review, and also sorry for the waiting for my reply, Sure, I can host a version on my own, do you have any requirements for me to publish a version with my changes, like a specific package name or some additional information in the readme or anything? Let me know, also feel free to close this PR then, thank you! |
Feel free to host your own package, or you can simply create a separate module within this repo. For example, similar to logto_client.dart, you can create a logto_custom_client.dart file and export it in the SDK. This approach should save you a lot of effort. |
Ah that sounds good, I will try to rebase the files this weekend, and update things, also I will implement the suggested file changes and let you know! Thanks. |
What is the timeframe on this PR being finalized and incorporated? Not harassing just checking. Thanks |
@simeng-li I updated my pr from this repo, created the LogtoClientCustom class. @drewid you can use my repo directly until this is not closed by referencing it in the dependencies in
And use the |
Summary
This PR replaces web_auth library with url_launcher and app_links and
local server
options, this setup gives the user more control, also this provides a cross-platform solution (all this started because I needed desktop support).Edit: the
url_launcher
could handle an issue I saw in the issues regarding forcing a page to open in an external browser, with this PR this would be now possible.Also before I did everything you see here, I tried to implement
flutter_web_auth_2
I had ugly java kotlin compatibility issues which I wasnt able to handle, but I am not good with android configuration. The dart part was almost a drop in replacement tho.There are 2 callback strategies:
io.logto//callback
I am using GetIt for dependency injection and here is my extension method to register differen strategies (note: app id is also conditional in the config because one app is a flutter app listening to the logto scheme callback, the second is a react app listening to http callback). If this PR with modifications would go through it would be nice to allow more options for custom schemes?
Additional changes for better usability, a stream was added to the client to notify user about athentication changes, so there will be no additional state widget needed. This needs initialization for that an init() method was also added to the client. Example usage in the standard template for flutter app:
Using the stream and listen to authentication changes in an example AuthGuard widget:
Testing
I tested this by directly replacing the logto_dart_sdk with the forked and changed version locally. I run the application which I am building in an android emulator and on ubuntu as a dektop app. I tested the local server options on both devices and the scheme option on andoid only, on android the URL launcher also used a webview directly from the app.
Checklist
Nothing from these at this point, I would like to use this PR for further discussion, future options and feedback.
.changeset