Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase's Facebook login on React-native-android

I've been trying to get the Facebook login snippet from Firebase's documentation to work but I get the following console error:

window.open is not a function

What is the correct way to implement Firebase's Facebook login on a React Native app ?

like image 694
Yesid Ghisays Avatar asked Aug 13 '26 11:08

Yesid Ghisays


1 Answers

This was answered in How to use Firebase Twitter Authentication with React Native?

It's because the JavaScript version of Firebase was written for the web and not React Native. Most of the API works correctly except for:

  • Social authentication. Uses browser functions to open a new window or redirect.
  • Caching data and authentication. Looks like it's built for synchronous local storage instead of React Native's asynchronous storage.

I started using Firebase Web for my React Native app and implemented Facebook login using the Facebook iOS SDK as a native module then passing the token to authWithOAuthToken.

Now that I've found persistence doesn't work either I'm considering using the Firebase iOS and Android APIs wrapping only the required methods as native modules instead of trying to re-implement persistence.

like image 158
SteveMellross Avatar answered Aug 15 '26 13:08

SteveMellross



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!