FirebaseUI-iOS
FirebaseUI-iOS copied to clipboard
Email link re-authentication doesn’t work
Environment
- Objective C or Swift: Swift
- iOS version: 12.2
- Firebase SDK version: 6.4.0
- FirebaseUI version: 8.0.4
- CocoaPods Version: 1.7.3
Describe the problem:
Steps to reproduce:
- Setup anonymous & email link authentication
- Set
shouldAutoUpgradeAnonymousUsers
totrue
- Sign in anonymously
- Authenticate with email link
- Sign out
- Sign in anonymously again
- Authenticate with email link same as email of step4
- Email link authentication does not work
Observed Results:
- What happened? This could be a description, log output, etc.
- The error
FIRAuthErrorCodeEmailAlreadyInUse
is occurred- https://github.com/firebase/FirebaseUI-iOS/blob/master/EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.m#L381-L387
- However success alert is displayed because completion handler does not handle
FIRAuthErrorCodeEmailAlreadyInUse
error- https://github.com/firebase/FirebaseUI-iOS/blob/master/EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.m#L355-L374
Expected Results:
- Sign in with email link succeeds
Relevant Code:
- https://github.com/firebase/FirebaseUI-iOS/blob/master/EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.m#L381-L387
- https://github.com/firebase/FirebaseUI-iOS/blob/master/EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.m#L355-L374
Thanks
I have been working on a problem that I believe is exactly this issue. I have a workaround for re-authentication, but it isn't ideal: https://stackoverflow.com/questions/58290744/firebase-ui-email-link-opens-app-and-is-handled-by-the-proper-method-but-does-n/58313033#58313033
I also provide more context on where the issue is occurring which can be summed up as:
- Anonymous user inputting email for email link sign in/up will cause the email link to provide a field containing the anonymous user's uid
- Handling an email link with an anonymous uid will Always cause the email auth provider to attempt to auto upgrade an anonymous user
- Attempting to auto upgrade an anonymous user to an existing email-link account will always fail
- If
shouldAutoUpgradeAnonymousUsers = false
, then the above will happen regardless, but inhandleAnonymousUpgrade
the initial check will always fail, and the email auth provider will default to handling the login attempt as if the user has tried to sign in on a different device which never signs the user in
Not sure if this is the intended outcome for this scenario, but since this issue is still open I thought I would contribute more information to help pinpoint the issue.