I correctly set up Facebook sign-in with Firebase on my app and now I'd like to make the user able to delete his account. I'd like to re-authenticate the user before deleting the account, but I don't have success.
I followed this example How to re-authenticate a user on Firebase with Google Provider? but the snippet provided by the person who asked the question doesn't help me.
Here is my code
//get the token from the signed in account
val credential = FacebookAuthProvider.getCredential(AccessToken.getCurrentAccessToken().toString())
//reauthenticate the user
user.reauthenticate(credential)
.addOnCompleteListener { task ->
if(task.isSuccessful)
Toast.makeText(activity, "Authentication successful!!!",Toast.LENGTH_LONG).show()
else
Toast.makeText(activity, "Authentication NOT successful", Toast.LENGTH_LONG).show()
}
The problem is, when I click the button "Delete" the string "Authentication NOT successful" always appears on screen.
Thank you all in advance.