Skip to content
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

How to update a user's email now that updateEmail(to: email) is deprecated #12185

Closed
yqiang opened this issue Dec 11, 2023 · 10 comments
Closed

Comments

@yqiang
Copy link

yqiang commented Dec 11, 2023

Description

We just upgraded our Firebase SDK to the latest version and are receiving a warning that the method updateEmail(to: email) has been deprecated. The warning suggests that we use sendEmailVerification(beforeUpdatingEmail email: String) instead.
For our user case however, we don't want to send a verification email, but we just want to set the users email manually.

It looks like the relevant pull request is this one: Email enumeration protection related error and doc updates #12081

What is the recommended way to do this now that the above method has been deprecated?

Reproducing the issue

  1. Install Firebase SDK for iOS
  2. Call the updateEmail(to: email) method.
  3. See warning in Xcode

Firebase SDK Version

10.19.0

Xcode Version

15.0

Installation Method

Swift Package Manager

Firebase Product(s)

Authentication

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@yqiang yqiang changed the title How to update a users email now that updateEmail(to: email) is deprecated How to update a user's email now that updateEmail(to: email) is deprecated Dec 11, 2023
@rizafran
Copy link
Contributor

Hi @yqiang, upon checking the docs, you need to use the verifyBeforeUpdateEmail as your users can no longer update their email with the updateEmail() method when the enumeration protection feature is enabled. If you want your users to update their email without verification, you may disable the enumeration protection feature, but note that it is not recommended in the long term.

@yqiang
Copy link
Author

yqiang commented Dec 13, 2023

@rizafran Hi - thanks for the quick reply. In my particular use case, I'm using Sign in With Apple and passing the email I get from that to the updateEmail() method. Since the email is coming from someones Apple account, it is already verified. What's the recommended way to pass the email to Firebase now?

@Xiaoshouzi-gh
Copy link
Contributor

Hi @yqiang can you describe and explain your workflow / code logic so we can better help you? Do you create an account randomly with email password, then signInWithApple and then updateEmail?

@yqiang
Copy link
Author

yqiang commented Dec 18, 2023

@Xiaoshouzi-gh Sure. Here's the workflow:

  • User signs up for my app using Sign in with Apple, and I request email as part of the permissions
  • Given the Sign in with Apple tokens, I call my own backend and generate a custom Firebase token using the python firebase-admin sdk
  • I call Auth.auth().signIn(withCustomToken: token) on the client
  • I call updateEmail(to: email) on the client. The email is what I received when signing in with Apple

@yqiang
Copy link
Author

yqiang commented Jan 28, 2024

Hi - I was wondering if there's an update on this issue?

@Xiaoshouzi-gh
Copy link
Contributor

Hi @yqiang, another option is to utilize firebase blocking function to update the user record with emailVerified = true during signIn and account creation phase. See this example here

@google-oss-bot
Copy link

Hey @yqiang. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@yqiang if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@arda-copur
Copy link

It is very interesting to remove such a needed feature. Is this complexity really needed? I can update the user's password, but I still haven't found an equivalent for email.

@firebase firebase locked and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants