问题
Every year i want my Firebase users to verify their account-email again, to check that their Email address are still in use.
To test this i sent a new verification email to my (already verified) account. The mail was sent, but this did not set my .isEmailVerified
to false, also after reloading the currentUser
and the app.
Does anyone know if it´s possible to set the .isEmailVerified
to false, once it is true at all, and if so how to do it?
回答1:
Sending a verification email does not set the emailVerified
property to false
. That is the expected and intended behavior.
If you want to set the emailVerified
property of a user to false
, you can do so with the Firebase Admin SDK. For example, in Node.js it would be:
admin.auth().updateUser(uid, {
emailVerified: false
})
For more examples (including in other languages) see the Firebase documentation on updating a user profile.
Note that the Admin SDK has full administrative access to your Firebase project, so should only be run from a trusted environment, such as your development machine, a server you control, or Cloud Functions for Firebase. In no instance should you try to put this functionality in the app you give to your uses, as doing so will give them administrative access to your Firebase project.
来源:https://stackoverflow.com/questions/51573021/set-isemailverified-of-already-verified-firebase-users-to-false