-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(auth): implement legacyFetchSignInWithEmail configuration option
#2316
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
Open
russellwheatley
wants to merge
7
commits into
version-10.0.0-beta03
Choose a base branch
from
fetchSigninWithEmail
base: version-10.0.0-beta03
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
96506d9
feat(auth): implement legacyFetchSignInWithEmail configuration option
russellwheatley c7cc486
test: write tests for legacyFetchSignInWithEmail
russellwheatley ed1d89a
fix(pr): address reviewer feedback on email recovery routing
russellwheatley d533fcf
refactor(pr): address reviewer feedback on legacy email recovery
russellwheatley 2f69328
fix: cancellation callback + test
russellwheatley 7318ad5
chore: ignore kotlin cache
russellwheatley 2cab2fc
chore: run demo app script from command line
russellwheatley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,12 @@ import androidx.compose.ui.Modifier | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.ui.text.style.TextAlign | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.ui.window.DialogProperties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.firebase.ui.auth.AuthException | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.firebase.auth.EmailAuthProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.firebase.auth.FacebookAuthProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.firebase.auth.GithubAuthProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.firebase.auth.GoogleAuthProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.firebase.auth.PhoneAuthProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.google.firebase.auth.TwitterAuthProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.firebase.ui.auth.configuration.string_provider.AuthUIStringProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -158,6 +164,9 @@ private fun getRecoveryMessage( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Use the custom message which includes email and provider details | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| error.message ?: stringProvider.accountLinkingRequiredRecoveryMessage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.DifferentSignInMethodRequiredException -> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| error.message ?: stringProvider.accountLinkingRequiredRecoveryMessage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.EmailMismatchException -> stringProvider.emailMismatchMessage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.InvalidEmailLinkException -> stringProvider.emailLinkInvalidLinkMessage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.EmailLinkWrongDeviceException -> stringProvider.emailLinkWrongDeviceMessage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -192,6 +201,8 @@ private fun getRecoveryActionText( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.AuthCancelledException -> error.message ?: stringProvider.continueText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.EmailAlreadyInUseException -> stringProvider.signInDefault // Use existing "Sign in" text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.AccountLinkingRequiredException -> stringProvider.signInDefault // User needs to sign in to link accounts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.DifferentSignInMethodRequiredException -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDifferentSignInMethodActionText(error.suggestedSignInMethod, stringProvider) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.MfaRequiredException -> stringProvider.continueText // Use "Continue" for MFA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.EmailLinkPromptForEmailException -> stringProvider.continueText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.EmailLinkCrossDeviceLinkingException -> stringProvider.continueText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -226,6 +237,7 @@ private fun isRecoverable(error: AuthException): Boolean { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.PhoneVerificationCooldownException -> false // User must wait for cooldown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.MfaRequiredException -> true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.AccountLinkingRequiredException -> true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.DifferentSignInMethodRequiredException -> true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.AuthCancelledException -> true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.EmailLinkPromptForEmailException -> true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is AuthException.EmailLinkCrossDeviceLinkingException -> true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -235,3 +247,21 @@ private fun isRecoverable(error: AuthException): Boolean { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else -> true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private fun getDifferentSignInMethodActionText( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signInMethod: String, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stringProvider: AuthUIStringProvider, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): String { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+255
to
+266
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.