i would like to know if i am linking face book authentication with phone no. authentication and i have done it once but after logging out and if i try to login again it will again ask for my phone no. is there any way so that when i am logging in again it remembers that i have already done phone no. authentication.by adding these feature i can also restrict user from logging in without adding phone no.
my codes for fb authenticaton
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
Intent intent = new Intent(MainActivity.this,PhoneAuth.class);
startActivity(intent);
finish();
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(MainActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
progressBar.setVisibility(View.GONE);
// [END_EXCLUDE]
}
});
}
and here is my codes phon no authentication login
public void signInWithPhoneAuthCredential(PhoneAuthCredential credential){
mAuth.getCurrentUser().linkWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d(TAG, "linkWithCredential:success");
Intent intent = new Intent(PhoneAuth.this, Main2Activity.class);
startActivity(intent);
} else {
Log.w(TAG, "signInWithCredential:failure", task.getException());
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
// [START_EXCLUDE silent]
mVerificationField.setError("Invalid code.");
// [END_EXCLUDE]
}else{
Toast.makeText(PhoneAuth.this, "No.Already Used",
Toast.LENGTH_SHORT).show();
Intent intent=new Intent(PhoneAuth.this,Main2Activity.class);
startActivity(intent);
}
}
}
});
@samtstern
i would like to know if i am linking face book authentication with phone no. authentication and i have done it once but after logging out and if i try to login again it will again ask for my phone no. is there any way so that when i am logging in again it remembers that i have already done phone no. authentication.by adding these feature i can also restrict user from logging in without adding phone no.
my codes for fb authenticaton
and here is my codes phon no authentication login