首页 > 解决方案 > Firebase 错误:您必须在控制台中启用此服务

问题描述

尝试创建用户时出现以下错误

注意:这篇文章可能看起来很长,但总的来说我认为它主要是在控制台中安装 firebase 的说明。

不允许此操作。您必须在控制台中启用此服务。

我正在 iPhone X 设备上尝试这个,可能在模拟器中运行最新的 ios。

我正在使用 react-native-firebase 模块

这就是我的注册操作的样子

import firebase from "react-native-firebase";

export const signup = (fullName, username, email, password) => {
  console.log(`Full name: ${fullName} UserName: ${username} email: ${email} password: ${password}`)
  return function(dispatch) {
    dispatch({ type: PROFILE_LOADING });
    firebase
      .auth()
      .createUserWithEmailAndPassword(email, password)
      .then(user => {
        console.log("This is user from signup", signup);
        return dispatch({
          type: PROFILE_SUCCESS,
          payload: user
        });
      })
      .catch(error => {
        console.error(error)
        return dispatch({
          type: PROFILE_ERROR,
          payload: error.data
        });
      });
  };
};

在我的 firebase 身份验证中,我启用了使用电子邮件和密码进行注册

在此处输入图像描述

我已经按照文档中提到的那样进行了更改,即在我的AppDelegate.m

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
   // more code

我的 pod 文件看起来像这样

# Pods for entreClientwithoutExpo
  pod 'Firebase/Core'
  pod 'Firebase/Auth'

  target 'entreClientwithoutExpo-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
    pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

    pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

  end

我的文件夹结构包含GoogleService-Info.plist如下所示

在此处输入图像描述

我根据指令做的一件事是创造rn-cli.config.js

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
  resolver:{
    blacklistRE: blacklist([
      /nodejs-assets\/.*/,
      /android\/.*/,
      /ios\/.*/
    ])
  },
};

问题:知道我做错了什么吗?

更新:使用基于 Web 的登录,它可以正常工作,但我打算使用 firebase firestore,为此我需要它与应用程序一起本地工作

更新:捆绑标识符也可能有错误?

查看-tvOS包标识符时,恰好是这个 org.reactjs.native.example.entreClientwithoutExpo-tvOS

但通常是

app.entre

这是附加的(可能是相关的屏幕截图

在此处输入图像描述 在此处输入图像描述 在此处输入图像描述

更新 2:我的应用也没有经过验证

在此处输入图像描述

另外,我们是否需要为应用添加任何 URL?

标签: iosfirebasereact-nativereact-native-firebase

解决方案


您可以跳过上面的验证步骤,但您需要在下面进行以下配置:

在此处输入图像描述

您需要正确配置app idbundle id.

在此处输入图像描述

正如我在 github 上的帖子中所解释的那样, firebase 在您的谷歌云控制台中创建了三个 api 密钥。

一个 api 密钥用于您的ios应用程序,一个用于您的android应用程序(您没有这个),一个 api 密钥用于web.

在此处输入图像描述

在此处输入图像描述

以后我会继续更新这篇文章,这里有一些我一直在检查你的问题的链接

https://invertase.io/oss/react-native-firebase/guides

https://duckduckgo.com/?q=medium+react+native+firebase+configuring+ios&t=canonical&ia=web

https://duckduckgo.com/?q=medium+react+native+firebase+configuring+ios&t=canonical&ia=web

https://firebase.googleblog.com/2016/01/the-beginners-guide-to-react-native-and_84.html

Android中的Firebase身份验证错误


推荐阅读