问题
When updating user's email using admin.auth().updateUser({email: newEmail})
the user's email gets updated (as an authentication provider). But whenever I refresh the page, the user gets logout.
Is there a way I can prevent that from happening and keeping the user logged in after its email gets updated?
回答1:
Firebase treats the email address as its primary way of finding the account for a user when you don't (yet) have their UID. For that reason the email address is considered sensitive information, and changing it requires that the user reauthenticates before they can continue to use the app.
The Admin SDK documentation doesn't explicitly mention this as far as I can see, but you sort'of derive it from the documentation on setting a user's email address.
来源:https://stackoverflow.com/questions/65835551/firebase-admin-when-updating-users-email-user-gets-logout-if-page-is-refreshed