Saturday, 4 May 2019

Firebase Error: You must enable this service in the console

I am getting the following error when trying to create a user

Note: This post might seem long but in general i think its mostly installation instruction of firebase in console..

This operation is not allowed. You must enable this service in the console.

I am trying this on iPhone X device probably running latest ios in simulator.

I am using react-native-firebase module

This is how my signup action looks like

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
        });
      });
  };
};

In my firebase authentication, I have enabled signup with email and password

enter image description here

I have made the changes as mentioned in the docs i.e in my 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

My pod file looks like this

# 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

And my folder structure containing GoogleService-Info.plist looks like this

enter image description here

One thing which I did out of the instruction was to create rn-cli.config.js

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

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

Question: Any Idea what could I be doing wrong?

Update: With Web based login, it works without error but I intend to use firebase firestore and for that I need it to work natively with app



from Firebase Error: You must enable this service in the console

No comments:

Post a Comment