Skip to content
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

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

Closed
maysamsh opened this issue Jun 1, 2022 · 8 comments
Closed

Comments

@maysamsh
Copy link

maysamsh commented Jun 1, 2022

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?

@biscottis
Copy link

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.

@vinhhoangdo
Copy link

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

@bartcone-fulfilld
Copy link

@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> />?

@vinhhoangdo
Copy link

vinhhoangdo commented Jul 9, 2022

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
Copy link

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?

@bartcone-fulfilld
Copy link

bartcone-fulfilld commented Jul 19, 2022

@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).

@vinhhoangdo
Copy link

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

@LinusU
Copy link
Owner

LinusU commented Nov 1, 2022

@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 LinusU closed this as completed Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants