Description
Step 1: Are you in the right place?
- For issues or feature requests related to the code in this repository file a GitHub issue.
Step 2: Describe your environment
- Android device: SM-S918B/DS
- Android OS version: 14
- Google Play Services version: 24.26.32
- Firebase/Play Services SDK version: 32.8.1
- FirebaseUI version: 8.0.0
(Also tried multiple Firebase BOM versions between 28.0.0-32.8.1, tried FirebaseUI 7.2.2, and using an API 34 Play Services enabled emulator, same result)
Step 3: Describe the problem:
Getting com.firebase.ui.auth.FirebaseUiException: Developer error
after going through authentication with Microsoft auth provider.
The error comes from ProviderUtils.java:229.
NOTE: My assumption is that this usecase happens, since the email I'm using [email protected] is already authenticated with Google as a provider.
The web AuthUI library handles this by asking giving the user the option to link the accounts. Is this what we don't have on Android, and if so, how do we handle this manually?
The setup in the firebase console, and the mobile client should be good, based on the facts that:
- Google authentication works on mobile as expected (suggesting the correct config is used)
- Microsoft authentication works for our webapp using the same project (suggesting the Firebase Console setup is correct)
Observed Results:
onActivityResult
is called after the Custom Google Chrome tab is closed with resultCode=0
, and info in data.extras:
IdpResponse{mUser=null, mToken='null', mSecret='null', mIsNewUser='false', mException=com.firebase.ui.auth.FirebaseUiException: Developer error, mPendingCredential=null}
Expected Results:
onActivityResult
called with a successful resultCode=-1
, authentication succeeds.
Relevant Code:
val intent = when (providerType) {
LoginProviderType.GOOGLE -> viewModel.getGoogleLoginIntent(email)
LoginProviderType.MICROSOFT -> viewModel.getMicrosoftLoginIntent(email)
else -> return@observeFreshly
}
startActivityForResult(intent, REQUEST_CODE)
-----
override fun getMicrosoftLoginIntent(email: String?): Intent {
val providerBuilder = AuthUI.IdpConfig.MicrosoftBuilder()
if (!email.isNullOrBlank()) {
providerBuilder.setCustomParameters(
mapOf("login_hint" to email)
)
}
return AuthUI.getInstance()
.createSignInIntentBuilder()
.setLogo(R.drawable.logo)
.setTheme(R.style.MyStyle)
.setAvailableProviders(arrayListOf(providerBuilder.build()))
.setIsSmartLockEnabled(false)
.build()
}
----
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) {
viewModel.onLoginFlowDone()
}
}