Skip to content

EmailLink && custom AuthmethodPickerLayout crash: "No button found for auth provider: emailLink" #1658

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

Closed
Entreco opened this issue Jul 20, 2019 · 1 comment

Comments

@Entreco
Copy link
Contributor

Entreco commented Jul 20, 2019

Step 1: Describe your environment

  • Android device: OnePlus 6
  • Android OS version: 9
  • Google Play Services version: 15.4.22
  • Firebase/Play Services SDK version: com.google.firebase:firebase-auth:18.0.0
  • FirebaseUI version: 5.0

Step 2: Describe the problem:

Using EmailLink sign in, in combination with a custom ui crashes the app.

Steps to reproduce:

  1. Enable EmailLink in Firebase console
  2. Enable EmailLink in AuthProvider: AuthUI.IdpConfig.EmailBuilder().enableEmailLinkSignIn().setActionCodeSettings(email).build(),
  3. Set Custom AuthMethodPicker layout: .setAuthMethodPickerLayout(layout)
  4. Start startActivityForResult(intent, )

Observed Results:

  • What happened?
    App crashes with Caused by: java.lang.IllegalStateException: No button found for auth provider: emailLink

Expected Results:

  • What did you expect to happen?
    AuthPickerActivity should be launched with my custom email button

Relevant Code:

private val providers =
      listOf(            AuthUI.IdpConfig.EmailBuilder().enableEmailLinkSignIn().setRequireName(true).setActionCodeSettings(ActionCodeSettings.newBuilder()
.setAndroidPackageName("package.name", true, null)
          .setHandleCodeInApp(true)
          .setUrl("https://google.com") // This URL needs to be whitelisted
.build()).build()
      )

private val picker = AuthMethodPickerLayout.Builder(_layout).setEmailButtonId(R.id.btn).build()

val intent = AuthUI.createSignInIntentBuilder()
          .setAuthMethodPickerLayout(picker)
          .setAvailableProviders(providers)
          .build()

startActivityForResult(intent, 1234)

The reason this error occurs, is that when you call .enableEmailLinkSignIn the provider Id changes from "password" to "emailLink" -> hence when populateIdpListCustomLayout is called, there is no matching button

@samtstern
Copy link
Contributor

This has been released in version 5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants