2

After the User has uninstalled the app, it doesn't un-authenticate the user. Even if the user is null, it calls onVerificationFailure(). Can I have it re-authenticate the new user or get the credentials of previous one despite it being null?

Firebase - Deleting and reinstalling app does not un-authenticate a user

Firebase FAuthData saved even after deletion of app

Log user out after app has been uninstalled - Firebase

I have found these cases for iOS and I do understand that the issue is similar to Android. However, neither signout() nor currentUser.delete() works in the case. At times currentUser is even null but I can't sign in again with this or newer user.

Also, android:allowBackup="false" doesn't solve the problem as suggested here with Android.

Firebase Auth saved after uninstall. How can I delete it?

My current code:

FirebaseAuth mAuth = FirebaseAuth.getInstance();
FirebaseUser mUser = mAuth.getCurrentUser();
if (mUser != null) {
    FirebaseAuth.getInstance().signOut();
    mUser.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful())
                Log.e(TAG, "Delete Success");
            else
                Log.e(TAG, String.valueOf(task.getException()));
        }
    });
} else
    Log.e(TAG, "User Null");

The code is in onStart() of activity. It either returns User Null or moves to failure function. SHA-1 is verified and uploaded. Firebase authentication is enabled. Currently, only authentication by Phone Number is available to user end; no database or firestore is in use.

The other approach I tried (unsuccessfully) instead of deleting/signing out the user:

if (mUser.getPhoneNumber() != null)
     //Log In Logic
else
     //sign Up Logic

I expect the user to be able to log in or sign up, and not entirely be failed in verification process. Documents do not mention more than deletion or removal. Firebase docs even allow signout to be able to sign in with a different user. But it doesn't work here either.

Mashal Rashid
  • 314
  • 3
  • 16

0 Answers0