ThexXTURBOXx / flutter_web_auth_2

Flutter plugin for authenticating a user with a web service
https://pub.dev/packages/flutter_web_auth_2
MIT License
51 stars 50 forks source link

[Bug]: Session completion does not redirect me back to the app with my universal link and data (Only in IOS flutter App) #107

Closed Suman085 closed 4 months ago

Suman085 commented 4 months ago

Description

I have a different usecase here than authentication. I have a feature where i want the users to complete external tasks (which is done in browsers), once the tasks get completed, the third party would redirect us back to a universal link that's supported by my flutter app with the necessary data but it does not. The browser gets stucked in that final page without redirecting me back to the app. I have a similar case where i use flutter_web_auth_2 for paypal login, but it works as expected. (We can assume that the final redirect url is same for both)

Thanks for the awesome plugin. Thanks in advance for the help!!

Minimal Reproduction

Steps to reproduce the behaviour:

  1. Use the following code:
    final result =  await FlutterWebAuth2.authenticate(
                    url: externalLink, // this link redirects me to a external site.. once task is completed it redirects me back to a universal link that my app supports.
                    options: const FlutterWebAuth2Options(preferEphemeral:true),
                    callbackUrlScheme: "https",
                  );
                 print(result);

Exception or Error

There is no exception or Error. Even though I reach the final page, I am not redirected back to the IOS App.

Expected Behaviour

When i reached the final page that should be detected by my app as a universal link, it should navigate me back to the app with the callback url.

Screenshots

No response

Additional context

I got it working on both web and android. But ios does not want to work!

Device

Iphone *

OS

iOS 17.4

Browser

Safari

Flutter version

3.19.6

flutter_web_auth_2 version

3.1.1

Checklist

Suman085 commented 4 months ago

The reason for me to have this issue was because of the following reason:

Universal Links will not work with a user driven element click on the same domain. Example: if there is a Universal Link on google.com pointing to a different Universal Link on google.com, it will not open the app.

Basically, i was on the same sub-domain where i was expecting the universal link path pattern to trigger it from. Closing this.. I Hope this would be helpful..