feat(auth): implement legacyFetchSignInWithEmail configuration option#2316
feat(auth): implement legacyFetchSignInWithEmail configuration option#2316russellwheatley wants to merge 7 commits intoversion-10.0.0-beta03from
legacyFetchSignInWithEmail configuration option#2316Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a legacy recovery path for email sign-in, intended for use when email enumeration protection is disabled. It introduces the DifferentSignInMethodRequiredException and a legacyFetchSignInWithEmail configuration flag. The core logic uses the legacy fetchSignInMethodsForEmail API to suggest alternative providers when a user attempts to sign in with an incorrect method. The UI layer, including ErrorRecoveryDialog and various screens, has been updated to handle this recovery flow. Review feedback highlights a missing recovery case in the top-level FirebaseAuthScreen, a redundant check in the recovery logic, and the need to support generic OAuth providers in the provider redirection callback.
| return when (signInMethod) { | ||
| GoogleAuthProvider.PROVIDER_ID -> stringProvider.continueWithGoogle | ||
| FacebookAuthProvider.PROVIDER_ID -> stringProvider.continueWithFacebook | ||
| TwitterAuthProvider.PROVIDER_ID -> stringProvider.continueWithTwitter | ||
| GithubAuthProvider.PROVIDER_ID -> stringProvider.continueWithGithub | ||
| PhoneAuthProvider.PROVIDER_ID -> stringProvider.continueWithPhone | ||
| "apple.com" -> stringProvider.continueWithApple | ||
| "microsoft.com" -> stringProvider.continueWithMicrosoft | ||
| "yahoo.com" -> stringProvider.continueWithYahoo | ||
| EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD -> stringProvider.signInWithEmailLink | ||
| else -> stringProvider.continueText | ||
| } |
There was a problem hiding this comment.
There's a Provider enum in AuthProvider.kt, maybe we can use that to avoid the hardcoded strings but I don't think this would change anytime soon, just a nice to have.
| return when (signInMethod) { | |
| GoogleAuthProvider.PROVIDER_ID -> stringProvider.continueWithGoogle | |
| FacebookAuthProvider.PROVIDER_ID -> stringProvider.continueWithFacebook | |
| TwitterAuthProvider.PROVIDER_ID -> stringProvider.continueWithTwitter | |
| GithubAuthProvider.PROVIDER_ID -> stringProvider.continueWithGithub | |
| PhoneAuthProvider.PROVIDER_ID -> stringProvider.continueWithPhone | |
| "apple.com" -> stringProvider.continueWithApple | |
| "microsoft.com" -> stringProvider.continueWithMicrosoft | |
| "yahoo.com" -> stringProvider.continueWithYahoo | |
| EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD -> stringProvider.signInWithEmailLink | |
| else -> stringProvider.continueText | |
| } | |
| return when (Provider.fromId(signInMethod)) { | |
| Provider.GOOGLE -> stringProvider.continueWithGoogle | |
| Provider.FACEBOOK -> stringProvider.continueWithFacebook | |
| Provider.TWITTER -> stringProvider.continueWithTwitter | |
| Provider.GITHUB -> stringProvider.continueWithGithub | |
| Provider.PHONE -> stringProvider.continueWithPhone | |
| Provider.APPLE -> stringProvider.continueWithApple | |
| Provider.MICROSOFT -> stringProvider.continueWithMicrosoft | |
| Provider.YAHOO -> stringProvider.continueWithYahoo | |
| null -> if (signInMethod == EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD) { | |
| stringProvider.signInWithEmailLink | |
| } else { | |
| stringProvider.continueText | |
| } | |
| else -> stringProvider.continueText | |
| } |
| choose_target_device | ||
|
|
||
| echo "Building debug APK..." | ||
| "$repo_root/gradlew" :app:assembleDebug |
There was a problem hiding this comment.
Nice, thanks for adding this!
I got an error running this and found a possible fix.
Waiting for emulator-5554 to finish booting...
emulator-5554 is ready.
Building debug APK...FAILURE: Build failed with an exception.
- What went wrong:
Project directory '/Users/obscured-dir/obscured-dir/FirebaseUI-Android/app/scripts' is not part of the build defined by settings file '/Users/obscured-dir/obscured-dir/FirebaseUI-Android/settings.gradle'. If this is an unrelated build, it must have its own settings file.BUILD FAILED in 320ms
| "$repo_root/gradlew" :app:assembleDebug | |
| "$repo_root/gradlew" -p "$repo_root" :app:assembleDebug |
Screen recording shows my attempt at trying to sign-in with Github when I have an account with email provider only:
Screen_recording_20260420_132518.webm