The identity provider configuration is not found

当我try 使用FacebookAuthProvider对firebase进行身份验证时,出现此错误.我正在使用react-native fbsdk与react-native进行facebook身份验证集成.我的目标是使用身份验证令牌登录用户ti firebase,并将用户数据记录在firestore内的用户集合中.

下面是我的代码.任何帮助都将不胜感激.!

fbAuth(){
        LoginManager.logInWithReadPermissions(['public_profile','email','user_photos']).then(
            (result)=>{
                this.handleCallBack(result),
                function(error){
                    console.log("error in facebook login.");
                }
            }
        );
    }
    handleCallBack(result){
        var _this = this;
        if(result.isCancelled){
            console.log("facebook login cancelled.");
        }else{
            AccessToken.getCurrentAccessToken().then(
                (data) => {
                    const token = data.accessToken;
                    fetch('https://graph.facebook.com/v2.8/me?fields=id,first_name,last_name,gender,birthday&access_token=' + token)
                    .then((response=>response.json()))
                    .then((json)=>{
                        const imageSize = 120;
                        const facebookID = json.id;
                        const fbImage = "https://graph.facebook.com/${facebookID}/picture?height=${imageSize}";
                    })
                    this.authenticate(data.accessToken)
                    .then(result =>{
                        const {uid} =  result;
                        _this.createUser(uid,json,token,fbImage);
                    })
            })
            .catch(error=>{
                    console.log(error);
            })   
        } 
    }
    authenticate = (token) => {
        const provider = firebase.auth.FacebookAuthProvider;
        const credential = provider.credential(token);
        var ret = firebase.auth().signInWithCredential(credential);
        return ret;
    }
    createUser = (uid,userData,token,dp) => {
        const defaults = {
          uid,
          token,
          dp,
          ageRange: [20, 30]
        }
        const db = firebase.firestore();
        db.settings({timestampsInSnapshots:true});
        db.collection('USERS').add({
            ...userData, ...defaults,
            fsTimestamp: firebase.firestore.Timestamp.now()
        })
        .then(()=>{
            console.log("User recorded.");
                //this.clearState();
        })
        .catch((error)=>{console.log(error)});
     }

以下是我的作品:

import * as firebase from 'firebase';
import 'firebase/firestore';
import {LoginManager,LoginButton,AccessToken,GraphRequest,GraphRequestManager} from 'react-native-fbsdk';

推荐答案

我找到了.问题不在于代码.这实际上是一件非常基本的事情:)

sign-in providers screen

React-native相关问答推荐

AxiosError:Reaction Native EXPO开发版本中的网络错误

如何根据设备主题更改React Native中状态栏的背景?

使用react native 杀死应用程序后蓝牙仍处于活动状态

获取 TypeError:this.InnerNativeModule.configureProps 不是 mac 上 expo 中的函数

React Native - 如何在从另一个屏幕导航后将 ScrollView 滚动到给定位置

Jest 遇到了带有 react-native 的意外令牌

React Native Child Parent 通信

检索元素的父项时出错:找不到与给定名称android:TextAppearance.Material.Widget.Button.Colored匹配的资源

使用 .env 变量在 react-native 应用程序上设置 appcenter

xcrun:错误:SDK "iphoneos" cannot be located

React native Refresh 有效,但下一次调用仍使用最后一个令牌

使用像 React Navigation 这样的基于 JS 的导航解决方案优缺点?

Test suite无法运行 TypeError:Cannot read property ‘default’ of undefined

路由状态没有通过 redux 保持在 react-native

在 react-native 和 firebase 3.1 中登录 Facebook

如何将本地文本文件加载到 React Native Project 中的字符串变量中?

React Native ScrollView 在 iOS 上从底部被截断

运行时尚未准备好进行调试

未找到 React/RCTBridgeDelegate.h' 文件

React Native 的最佳文件 Select 器