I am trying to code the Delete User method in my Android application, but I am having problems every time I execute it. This method will be executed when the user clicks the "Delete account" button in the "Activities" section. My applications work with FirebaseUI Auth.
Here is the method:
private void deleteAccount() { Log.d(TAG, "ingreso a deleteAccount"); FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(); final FirebaseUser currentUser = firebaseAuth.getCurrentUser(); currentUser.delete().addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG,"OK! Works fine!"); startActivity(new Intent(Main3WelcomeActivity.this, Main3Activity.class)); finish(); } } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.e(TAG,"Ocurrio un error durante la eliminación del usuario", e); } }); }
1) When I perform this function, the message Smart Lock appears on the screen and the user logs in again. Here is a screenshot of this post.

2) In other cases, when the user has logged in for a long time, the function throws an exception similar to the following:
06-30 00:01:26.672 11152-11152/com.devpicon.android.firebasesamples E/Main3WelcomeActivity: Ocurrio un error durante la eliminación del usuario com.google.firebase.FirebaseException: An internal error has occured. [ CREDENTIAL_TOO_OLD_LOGIN_AGAIN ] at com.google.android.gms.internal.zzacq.zzbN(Unknown Source) at com.google.android.gms.internal.zzacn$zzg.zza(Unknown Source) at com.google.android.gms.internal.zzacy.zzbO(Unknown Source) at com.google.android.gms.internal.zzacy$zza.onFailure(Unknown Source) at com.google.android.gms.internal.zzact$zza.onTransact(Unknown Source) at android.os.Binder.execTransact(Binder.java:453)
I read that I have to re-authenticate the user, but I'm not sure how to do this when I work with Google Sign In.
source share