flutter_web_auth icon indicating copy to clipboard operation
flutter_web_auth copied to clipboard

Web auth shows two options to the user, app name and flutter_web_auth

Open maysamsh opened this issue 3 years ago • 7 comments

My app supports deep links and also uses this package for web auth. there is a confusing action sheet shown to the user before opening the browser:

screenshot

This is my intent:

<activity android:name="com.linusu.flutter_web_auth.CallbackActivity" android:exported="true">
           <intent-filter android:label="flutter_web_auth">
               <action android:name="android.intent.action.VIEW" />
               <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.BROWSABLE" />
               <data android:scheme="myappscheme" />
           </intent-filter>
       </activity>

Is there any way to open the browser right away instead of showing this confusing UI?

maysamsh avatar Jun 01 '22 14:06 maysamsh

Simply use a different scheme for either your deep links or flutter_web_auth. Yeah, it's more work to maintain another scheme but that's the workaround.

biscottis avatar Jun 09 '22 02:06 biscottis

I stuck with this issue. Does everyone have any solutions?

vinhhoangdo avatar Jul 08 '22 10:07 vinhhoangdo

@vinhhoangdo do you happen to have appAuthRedirectScheme defined with the same scheme name in manifestPlaceholders (build.gradle)? If not, what does your AndroidManifest.xml look like? Do you have two or more intents with the same <data android:scheme=<scheme> />?

bartcone-fulfilld avatar Jul 08 '22 15:07 bartcone-fulfilld

Yeah thank dude @bartcone-fulfilld, I will check the scheme name in manifestPlaceholders. In the AndroidManifest.xml: For this, I defined some intents like:

<application>
.....
  <activity >
   .......
    <intent-filter>
       <action android:name="android.intent.action.VIEW" />
       <category android:name="android.intent.category.DEFAULT" />
       <category android:name="android.intent.category.BROWSABLE" />
       <data android:scheme="myScheme" />
    </intent-filter>
  </activity>
  <activity android:name="com.linusu.flutter_web_auth.CallbackActivity">
             <intent-filter android:label="flutter_web_auth">
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />
                 <data android:scheme="myScheme" />
                 <data android:host="login" />
             </intent-filter>
  </activity>
  <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
</application>

And now, If I install the app and click on the Login button, it will show the dialog with two options! I will update more info about manifestPlaceholders (build.gradle)..! Thank you!

vinhhoangdo avatar Jul 09 '22 04:07 vinhhoangdo

Hi @bartcone-fulfilld, I am back to work and checking the manifestPlaceholders. So it does not define in the build.gradle. Could you tell me what am I supposed to do now man?

vinhhoangdo avatar Jul 11 '22 02:07 vinhhoangdo

@vinhhoangdo you have two <data android:scheme="myScheme" /> in that manifest file. Make them different and then try (by different I mean change the myScheme part).

bartcone-fulfilld avatar Jul 19 '22 14:07 bartcone-fulfilld

@bartcone-fulfilld yeah, I see. Is there any way to keep both schemes the same? Or both of them should differ from each other.

vinhhoangdo avatar Jul 22 '22 02:07 vinhhoangdo

@vinhhoangdo the schemes need to be different in order for the setup to work, since the callback must open the flutter_web_auth activity in order to receive the callback. I would suggest appending something like -auth to your callback scheme for the authentication.

Please also see the new troubleshooting section of the readme: https://github.com/LinusU/flutter_web_auth#troubleshooting

Let me know if you are still having problem!

LinusU avatar Nov 01 '22 09:11 LinusU