In firebase you can create an email verfication easily. However you need to create a new user. I would like to send an email verfication to a user's email without creating a new user.
This is an unsubscribe function where I want the user to be able to unsubscribe by entering an email. I then check if the user can log into that email via verification.
I cannot simply check if the email is authenticated as this allows users to delete any user.
Unsubscribe code
import { auth, db } from '../../../firebase-config'
export default function SubscribePopup(props) {
if (props.subscribe){
...
}
else{
#email verification ..
# if passes delete user
const userAuth = auth.currentUser;
userAuth.delete().then(() => {
console.log("Deleted user", email);
}).catch((error) => {
console.log("Error deleting user:", error);
});
setUnsubscribePop(false);
localStorage.setItem('signedIn', false);
}
}