@david said in Why doesn't the example flutter demo code from github work on Android?:

Hi all,

I've been following the tutorial for using FusionAuth in a flutter app here: https://fusionauth.io/blog/2020/11/23/securing-flutter-oauth

Using this code works perfectly in iOS, but doesn't work on my Android device (Google Pixel 6, Firefox browser).

So I tried downloading the sample project from https://github.com/FusionAuth/fusionauth-example-flutter-dart/, and substituting my own values for the FusionAuth domain, etc. Again, this works perfectly in iOS, but on Android I never get redirected back to the app.

There is some information here https://fusionauth.io/community/forum/topic/602/error-fusionauth-s-login-page-redirecting-issue-on-android/5 about creating an interstitial web page to complete the redirect to the app for Android devices. Is this really required? Or is there some step I'm missing here that will make this work for an Android app directly without needing to set up a special web page?

Thanks,

David

Hi David,

It sounds like you're dealing with a tricky issue with OAuth redirects on Android. Here are a few things you might consider:

Custom URL Scheme and Deep Links: Make sure your Flutter app is properly configured to handle custom URL schemes and deep links on Android. This setup is crucial for redirecting back to the app after authentication. Check your AndroidManifest.xml file to ensure it has the correct intent filters for handling your OAuth callback URL.

Browser Configuration: Sometimes, browser settings or extensions can interfere with OAuth redirects. Try testing with different browsers or clearing the browser cache and cookies on your Google Pixel 6.

Redirect URI Handling: Verify that the redirect URI configured in FusionAuth matches exactly with the one used in your app. Any mismatch can cause issues with the redirect process.

Interstitial Web Page: The information you found about creating an interstitial web page is a workaround that some developers use to handle OAuth redirects on Android. This page can help bridge the gap between the authentication provider and the app. However, it should not be necessary if the redirect is properly configured.

Logs and Debugging: Enable logging and check the logs for any errors or issues related to the OAuth flow. This can provide valuable insights into where the process might be failing.

If you’re still having trouble, you might want to consult the FusionAuth documentation or their community forum for additional support.

Good luck, and I hope you get this resolved soon!