1

We have native IOS and Android apps already published to stores. Currently about to finish react-native version to replace native apps. React-native app uses same firebase project that native. Firebase authentication works well on native apps and react-native android app. On react-native ios we are failed to sign in with google.

Error log:

Error: [auth/internal-error] An internal error has occurred, please try again. NativeFirebaseError: [auth/internal-error] An internal error has occurred, please try again. onGoogleButtonPress$@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:98254:89 tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28586:23 invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28759:32 tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28586:23 invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28659:30 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:28669:21 tryCallOne@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3475:16 http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3576:27 _callTimer@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:30574:17 _callImmediatesPass@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:30613:17 callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:30830:33

It's hard to figure out what exactly went wrong from error message.

When we configuring react-native IOS app to use sign in into other Firebase project (used for dev purpose), google sign in works fine. In both cases IOS bundle id is same.

All app related code and configuration done accordingly to react-native-firebase library docs.

The issue is also reproducible on newly created react-native project with same IOS bundle id and without any other side functionality code added.

import React from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Button,
  StatusBar,
} from 'react-native';

import {Colors} from 'react-native/Libraries/NewAppScreen';
import {GoogleSignin} from '@react-native-community/google-signin';
import auth from '@react-native-firebase/auth';

const App: () => React$Node = () => {
  async function onGoogleButtonPress() {
    const {idToken} = await GoogleSignin.signIn();
    const googleCredential = auth.GoogleAuthProvider.credential(idToken);
    return auth().signInWithCredential(googleCredential);
  }

  GoogleSignin.configure({
    webClientId:
      '<PASTE CLIEND ID FROM GoogleService-Info.plist>',
  });

  return (
    <>
      <StatusBar barStyle="dark-content" />
      <SafeAreaView>
        <ScrollView
          contentInsetAdjustmentBehavior="automatic"
          style={styles.scrollView}>
          <View style={styles.body}>
            <Button
              title="Google Sign-In"
              onPress={() =>
                onGoogleButtonPress().then(() =>
                  console.log('Signed in with Google!'),
                )
              }
            />
          </View>
        </ScrollView>
      </SafeAreaView>
    </>
  );
};

const styles = StyleSheet.create({
  scrollView: {
    backgroundColor: Colors.lighter,
  },
  body: {
    backgroundColor: Colors.white,
  },
});

export default App;

When added new IOS project with other bundle ID on production Firebase instance and set those bundle into react-native app, Firebase authentication works well.

So it does not look like issue in react native-app code, but something related to bundle id. In same time IOS native app with same bundle id works well.

Help me find out the reason why Firebase authentication does not work?

4
  • Usually when I can't get much info from the JavaScript console errors I look at the output of the Xcode console. Possibly firebase is not installed correctly. Make sure you run pod install in the React Native project ios folder. Also check that your GoogleServices-info.plist is in the same directory as your info.plist and that you added that file using Xcode and not just put it in the RN ios folder. Commented Aug 1, 2020 at 19:48
  • your not catching the error correctly, use a try/catch inside onGoogleButtonPress and check which error you get. then maybe we can help Commented Aug 2, 2020 at 0:36
  • Thanks Jack and Skorp for helping, Pod install is done and we use proper GoogleServices-info.plist and it in same directory than info.plist and it been added with use of Xcode add files to "Project" context menu with copying checkbox enabled. Also error log inside of xcode does not provide any additional information. Commented Aug 4, 2020 at 7:59
  • Hi Scorp, thanks for your comment. Sadly but catching error does not provide additional info. Commented Aug 4, 2020 at 9:31

1 Answer 1

0

I have met the same issue and I didn't find any documentation about this. So here is my experience.

I also had one Firebase project for my dev environment and everything worked fine. I made another one for my prod environment and Firebase-auth systematically returned the error "An internal error has occurred, please try again" on ios.

So I changed the bundle id for the prod project (and of course on Xcode) and the issue was gone.

It makes sense, on android you can't have the same pair package name / sha certificate. On ios the same restriction is merged on the unique bundle id. But it would be better if an error occurs like on android.

So in conclusion : use only one bundle id by Firebase project !

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.