How to re-authenticate firebase to delete user?

I am using Firebase authentication and as mentioned in Firebase documentation here to delete a user fresh authentication is required and to do so the user has to be re-authenticated as shown in the following section in the documentation.
I am using Facebook authentication with Firebase … So how to do it using Expo ?
Note: I have tried to sign out and re-signin but it didn’t work as this doesn’t count as a refresh to Firebase. It has to be done through the re-authentication mentioned in the documents.

There is nothing extra that is required when using the Firebase JS SDK’s Auth with Expo as opposed to a vanilla React-Native project. In order for Firebase to recognize that the user has been re-authenticated, you need to use the user.reauthenticateWithCredential(credential). I personally haven’t used Facebook as an Auth provider with Firebase, but I found this snippet from a SO post: (credential = FacebookAuthProvider.getCredential(AccessToken.getCurrentAccessToken().toString()))

Here’s the SO post: android - How to re-authenticate a user on Firebase with Google Provider? - Stack Overflow

Hopefully that helps shed some light on your situation.

Cheers,

Adam

Thanks for your reply Adam. But problem is from where I can import FacebookAuthProvider to make it happen ?

My bad. Didn’t realize that SO post was for Android. Here’s a SO post on it for JS: javascript - Firebase reauthenticate social provider - Stack Overflow

It looks like it is part of the Firebase Auth API so you just call firebase.auth().FacebookAuthProvider.credential(facebookaccesstoken)

1 Like

Will try it … thanks very much for your help