koji-1009 / flutter_auth_ui

A Flutter plugin for using the Firebase Auth UI with Dart in Flutter apps. (not official plugin.)
https://pub.dev/packages/flutter_auth_ui
36 stars 10 forks source link

The process of `FlutterAuthUi.startUi()` is not completed #76

Closed morio77 closed 3 years ago

morio77 commented 3 years ago
          onPressed: () async {
            final providers = [
              AuthUiProvider.email,
              AuthUiProvider.apple,
              AuthUiProvider.github,
            ];

            final result = await FlutterAuthUi.startUi(
              items: providers,
              tosAndPrivacyPolicy: TosAndPrivacyPolicy(
                tosUrl: 'https://www.google.com',
                privacyPolicyUrl: 'https://www.google.com',
              ),
              emailAuthOption: const EmailAuthOption(
                enableMailLink: true,
                handleURL: 'https://xxx.page.link/test',
                androidMinimumVersion: '',
                androidPackageName: 'com.example.yyy_sample',
              ),
            );

            print(result); // not executed.
          },
koji-1009 commented 3 years ago

Hi, @morio77

What happens in the following two cases?

  1. Set false to enableMailLink
  2. Set 1 to androidMinimumVersion

Also, isn't an error log output?

morio77 commented 3 years ago

@koji-1009

In the following cases, there was no problem.

Set false to enableMailLink

In the following cases, there was a problem according to the issue title.

Set 1 to androidMinimumVersion

koji-1009 commented 3 years ago

@morio77 Have you finished setting up the firebase console? https://firebase.google.com/docs/auth/android/email-link-auth#enable_email_link_sign-in_for_your_firebase_project

morio77 commented 3 years ago

@koji-1009

Yes, email link verification completes the login itself.

koji-1009 commented 3 years ago

@morio77 Oh, I see.

It probably works if you change the handleURL to the URL you want to transition to instead of dynamic links. The document is wrong, I will fix it.

koji-1009 commented 3 years ago

https://github.com/firebase/snippets-android/blob/8184cba2c40842a180f91dcfb4a216e721cc6ae6/auth/app/src/main/java/com/google/firebase/quickstart/auth/MainActivity.java#L340

morio77 commented 3 years ago

@koji-1009

When coming back to the app from the browser, the Android app was launching as another activity.

When I modified AndroidManifest.xml to launch the app as the same activity, this problem did not occur.

https://github.com/morio77/flutter_auth_ui_sample/blob/main/android/app/src/main/AndroidManifest.xml#L8

koji-1009 commented 3 years ago

@morio77

Isn't that the setting in the Flutter template? Sorry, I don't know what is being pointed out.

https://github.com/flutter/flutter/blob/2.5.0/packages/flutter_tools/templates/app_shared/android.tmpl/app/src/main/AndroidManifest.xml.tmpl#L8

morio77 commented 3 years ago

@koji-1009

Flutter's template is singleltop, but when I changed it to singleInstance, it returned from startUi().

I'm just guessing from here, but I think that the mail sending completion screen is called by native code, so if I change it to singletop, I can't go back to the Flutter code.

I'm not familiar with native code, so I apologize if I'm wrong.

koji-1009 commented 3 years ago

@morio77 What is the purpose of this issue? I'm sorry, but I can't figure it out.

morio77 commented 3 years ago

@koji-1009

The purpose of this Issue is to report a bug that may prevent FlutterAuthUi.startUi() from returning.

By modifying AndroidManifest.xml, I was able to solve my problem, so you can close this Issue if you want.

koji-1009 commented 3 years ago

See the commit here and change the URL to set.

https://github.com/koji-1009/flutter_auth_ui/commit/d280ca30fcee4708ce129bd5307cd2c63a33621b#diff-cb6f6bb0f943995e17737dd8710e3d814e5cebf3f58fa327c6d4c26c9df641fb