supabase-community/flutter-auth-ui

iOS Login WebView doesn't close after loading redirectUrl

Closed this issue · 3 comments

Bug report

Describe the bug

First: works fine on Android.
The Google Login flow opens a iOS WebView in which the classic Google login is done.
When that is successful, the WebView is supposed to redirect to the specified redirectUrl.
While this technically works (the WebView opens the URL), deep links are not working in the WebView.
Neither "normal" deep links "app://route/xyz" nor universal deep links "https://app.com/route/xyz" are working in this situation. They are redirecting to the URL, but the deep link is not working, so it doesn't close the WebView and goes back into the app. Instead, if using a "normal" deep link, it throws a exception after closing the WebView, saying that the URL couldn't be opened, and if using a universal deep link, it just navigates to the link in the browser, instead of switching back into the app.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Follow this Flutter Universal Deep Link Guide: https://docs.flutter.dev/cookbook/navigation/set-up-universal-links
  2. Add flutter-auth-ui to your app.
  3. Set the redirectUrl and all the other parameters accordingly.
  4. Login via Google.

Expected behavior

The WebView closes after it redirects to a deep link.

System information

iOS version: 16.7.10
Flutter version: 3.24.3
flutter-auth-ui version: ^0.5.0

Could you try tweeking the authScreenLaunchMode parameter? I think externalApplication will work.

Could you try tweeking the authScreenLaunchMode parameter? I think externalApplication will work.

Yes! Thanks for your fast replay, already tried to play around with that, and indeed, using LaunchMode.externalApplication works.
Which probably means, that our configuration is okay, no?
Is this some weird Apple behaviour again?

On the other hand I'm quite sure that I've seen iOS apps that use deep links with WebViews, afaik.

Yeah, not sure, but glad to hear that it works for you now!