function facebookSignIn(type, username) {
const facebookProvider = new FacebookAuthProvider();
const provider = new GoogleAuthProvider();
return signInWithPopup(auth, facebookProvider)
.then(async (result) => {
console.log(result);
const cred = getAdditionalUserInfo(result);
})
.catch((error) => {
console.log(error);
});
}
function googleSignIn(type, username) {
const googleProvider = new GoogleAuthProvider();
const provider = new FacebookAuthProvider();
return signInWithPopup(auth, googleProvider).then(async (result) => {
console.log(result);
const cred = getAdditionalUserInfo(result);
});
}
After signIn with google I want to link that account with Facebook so the user can login with Facebook later .Can anyoone help me with the flow How to achieve
In my experience you will not be able to automatically link Facebook auth through Google Auth. When a user authenticates with Google, it's Google validating the email/password of this gmail account. Facebook has nothing to do with it. If you want your user to also auth in Facebook and link this auth method with your current user, I would suggest to maybe allow him to add a new authentication method under its profile details. However, it is highly unlikely that a user will use more than 1 auth method.