firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.66k stars 1.49k forks source link

Sign In With Apple credential doesn't update email #6448

Closed mozeryansky closed 4 years ago

mozeryansky commented 4 years ago

Steps to reproduce:

I am using Sign In With Apple using the OAuthProvider credential. I am able to login and confirm that Firebase Authentication console shows that the account is linked with Apple. However, when testing I removed my Apple ID and signed in with a new hidden email, but firebase kept the original email.

authDataResult?.additionalUserInfo?.profile?["email"] shows the new email that I used with Sign In With Apple, but the authDataResult?.user.email shows my original email.

Relevant Code:

I followed the example from https://peterfriese.dev/replicating-reminder-swiftui-firebase-part3/

@peterfriese

I plan to use updateEmail, but this seems like a problem that should be handled by Firebase. Maybe instead of OAuthProvider there can be a AppleAuthProvider like there is GoogleAuthProvider/FacebookAuthProvider to handle this privacy requirements.

malcolmdeck commented 4 years ago

Hey mozeryansky,

I think this is working as intended. Once you create an account with Firebase, the email used at account creation time is bound to the account, even if you unlink the provider that set that email. That's so that account recovery flows still have somewhere to send password reset links and the like. If this is causing problems for you, I think that the only solution is using updateEmail as you've suggested.

I'm going to close this issue for now, but if I've missed something about the issue (particularly with respect to the privacy concerns), please feel free to re-open this issue and comment with more detail. :)

Hope that helps! ~Malcolm