I am creating a simple web portal using firebase cloud authentication. One user is an admin who will create other normal users and handover the credentials to normal user.
var newUser = firebase.auth().createUserWithEmailAndPassword(newEmail, newPassword);
Now I want that admin should have option to reset password for any normal user.
How can I achieve this? Can anyone please share any idea.
Thanks!
答案 0 :(得分:0)
您可以通过在管理SDK中调用updateUser()
来执行此操作。来自this documentation page的示例:
admin.auth().updateUser(uid, {
email: "modifiedUser@example.com",
emailVerified: true,
password: "newPassword",
displayName: "Jane Doe",
photoURL: "http://www.example.com/12345678/photo.png",
disabled: true
})
.then(function(userRecord) {
// See the UserRecord reference doc for the contents of userRecord.
console.log("Successfully updated user", userRecord.toJSON());
})
.catch(function(error) {
console.log("Error updating user:", error);
});
此功能目前仅适用于Admin SDK的Node.js版本。