I'm trying to send an email verification to users using firebase auth admin. All examples seem to use firebase.auth().currentUser;, however, in my case I am logged in as an admin user viewing a custom dashboard list of users to take action on rather than being logged in as an individual user.
I can successfully change a user record using this approach by passing in the UID to the updateUser method and the changes... e.g.
let userRecord = await fbAuth.updateUser(blogUID, {
email: req.body.BloggerEmail
})
and can retrieve the userdetails of the user I want using:
var userA = await fbAuth.getUser(blogUID)
However, the user object returned by this method does't allow me to call the sendEmailVerification method (it appears getUser doesn't return the same object type as getCurrentUser
try {
var userA = await fbAuth.getUser(blogUID).sendEmailVerification()
console.log("Sent new verification email");
} catch(error) {
console.log("Error sending verification email " + error);
}
[this fails, sendEmailVerification is not a method]
Official Reference Doc I've tried to use: https://firebase.google.com/docs/auth/web/manage-users#send_a_user_a_verification_email
Appreciate your help.