dart-lang / tools

This repository is home to tooling related Dart packages.
BSD 3-Clause "New" or "Revised" License
30 stars 21 forks source link

Login prompts while opening web app links #377

Open durga-nannamsetty opened 1 year ago

durga-nannamsetty commented 1 year ago

We are developing a Flutter app and need to integrate OAuth2. We also have existing web app that is OAuth2 enabled, and the user can open the web links from our (new) Flutter app.

We have decided to use “oauth2” to implement the authentication part mainly to support SSO between the flutter app + the web app that we open inside the mobile app in few screens. And we are using “url_launcher” package to open the web app links.

We can login inside the app using “oauth2” package. No issues in this.

However, when I login to the mobile app, and try to open the web app link using “url_launcher” package the web app prompts for the login credentials. But our expectation is that it should not prompt for login again because user already logged in for the same OAuth2 configuration.

I would like to get some understanding on this problem for both iOS and android. Is there any way to keep the session active internally?

AlexStroia commented 1 year ago

Have you found a fix?

durga-nannamsetty commented 1 year ago

For Android:- I am using ChromeSafariBrowser from "flutter_inappwebview" package.

And for iOS:- I am using mode: LaunchMode.externalApplication, from "url_launcher" package and opening the web links in Native Safari browser App instead of in-app browser because Apple does not allow sharing cookies with in-app browsers.

You can check the discussion here.

ahmednfwela commented 1 year ago

I recommend using package:oidc, it relies on AppAuth sdk for both android ios (which uses custom tabs), and provides customization for launching the browser