Firebase's Facebook login on React-native-android

戏子无情 提交于 2020-02-03 10:00:29

问题


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 ?


回答1:


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.



来源:https://stackoverflow.com/questions/32940326/firebases-facebook-login-on-react-native-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!