How to re-authenticate firebase to delete user?

#1

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.

#2

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: https://stackoverflow.com/questions/40898952/how-to-re-authenticate-a-user-on-firebase-with-google-provider

Hopefully that helps shed some light on your situation.

Cheers,

Adam

#3

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

#4

My bad. Didn’t realize that SO post was for Android. Here’s a SO post on it for JS: https://stackoverflow.com/questions/42202403/firebase-reauthenticate-social-provider

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

1 Like
#5

Will try it … thanks very much for your help