Firebase的Facebook登录React-native-android [英] Firebase's Facebook login on React-native-android
问题描述
我一直在尝试从Firebase的文档中获取Facebook登录代码片段,但是出现以下控制台错误:
窗口.open不是一个函数
在React Native应用程序上实现Firebase的Facebook登录的正确方法是什么? b $ b
这个答案在如何使用Firebase Twitter身份验证与React Native?
这是因为Firebase的JavaScript版本是为网络而不是反应本机。除了:
重定向。
存储构建了
。
$ b 我开始使用Firebase Web用于我的React Native应用程序,并使用Facebook iOS SDK作为本机模块实施Facebook登录,然后将令牌传递给 authWithOAuthToken
。
现在,我发现持久性不起作用,要么我正在考虑使用Firebase iOS和Android API,只将必需的方法作为本机模块,而不是试图重新实现持久性。
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 ?
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.
这篇关于Firebase的Facebook登录React-native-android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!