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

onActivityResult not called when using "sign in with email" #2169

Open
DaveInAus opened this issue Aug 25, 2024 · 1 comment
Open

onActivityResult not called when using "sign in with email" #2169

DaveInAus opened this issue Aug 25, 2024 · 1 comment

Comments

@DaveInAus
Copy link

  • Android device: LGE-LM-X430
  • Android OS version:10
  • Google Play Services version: 1.8.1
  • Firebase/Play Services SDK version: 4.3.10
  • FirebaseUI version: 33.1.0

Step 3: Describe the problem:

onActivityResult not called when using "sign in with email" i.e. when using an email link to sign-in.
The application is supposed to save the users email during this flow and it would seem a result should be returned to the activity so it can be handled.

Steps to reproduce:

  1. Start a Firebase UI Activity startForResult.launch(Intent(context, FirebaseUIActivity::class.java))
  2. Add an Email Provide AuthUI.IdpConfig.EmailBuilder() .enableEmailLinkSignIn() .setActionCodeSettings(actionCodeSettings) .build(),
  3. When the user has gone through the flow to save the users email so that it can be used when the user clicks on the link the onActivityResult is not called so that the users email can be saved somewhere

Observed Results:

onActivityResult no called

Expected Results:

  • onActivityResult should be called after "Sign-in email sent"

Relevant Code:

ublic class FirebaseUIActivity : AppCompatActivity() {

  // [START auth_fui_create_launcher]
  // See: https://developer.android.com/training/basics/intents/result
  private val signInLauncher = registerForActivityResult(
      FirebaseAuthUIActivityResultContract()
  ) { res ->
      var idToken : String? = null
      this.onSignInResult(res)
   }}

 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
}
@DaveInAus
Copy link
Author

DaveInAus commented Aug 31, 2024

Potentially this can really only be solved by updating the FirebaseUI Library

In auth/src/main/java/com/firebase/ui/auth/ui/email/EmailLinkFragment.java (https://github.com/firebase/FirebaseUI-Android)

it would be good to add a line to save the email to SharePreferences in

@Override
            protected void onSuccess(@NonNull String email) {
                Log.w(TAG, "Email for email link sign in sent successfully.");

                //*.   SAVE email TO SHARED PREFERENCES  *//

                doAfterTimeout(() -> mTopLevelView.setVisibility(View.VISIBLE));       
                mEmailSent = true;
            }

or alternatively if someone knows how to intercept this email during the passwordless email link flow it would be great to provide an example

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

1 participant