User is currently logged in with google but now wants to set the password if he wants to log in with Email and password. This is my code. But its giving me this error.
auth/requires-recent-login,
This operation is sensitive and requires recent authentication. Log in again before retrying this request.
Is there any solution to this? Note! User is currently logged in with google but now wants to set the password if he wants to log in with Email and password
let cred = firebase.auth.EmailAuthProvider.credential(
firebase.auth().currentUser.email,"new password here");
firebase.auth().currentUser.linkWithCredential(cred)
.then((usercred) => {})
.catch((error) => {
console.log("Account linking error", error);
});```