I am having a problem when combining the two provide logins on firebase, the problem here is that firebase must reauthenticate before combining the two login providers, how do I OTP to reauthenticate?
private void linkWithEmail(String email, String password) {
// i want linking OTP with email at firebase
AuthCredential credential = EmailAuthProvider.getCredential(email, password);
firebaseUser.linkWithCredential(credential).addOnCompleteListener(task -> {
if(task.isSuccessful()){
//do email verification
firebaseUser.sendEmailVerification().addOnCompleteListener(task1 -> {
if(task1.isSuccessful()){
//email verification has been sended
//my own code.....
}else{
Toast.makeText(this, "Verification Failed: " + task1.getException(), Toast.LENGTH_SHORT).show();
}
});
}else{
//exception firebase reauthentication will be here
Toast.makeText(AccountActivity.this, "Linking Failed: "+task.getException(), Toast.LENGTH_SHORT).show();
}
});
}