React Native: Standalone, Expo built app on Android crashes when using Facebook login (works on iOS)

The issue was that for Android, Facebook.initializeAsync() needs to be passed an argument — your FB appID.

  const handleFacebook = async () => {

    try {
      await Facebook.initializeAsync("123456789"); // <-- your FB appID

      const options = {
        permissions: ["public_profile"]
      }
      const { type, token } = await Facebook.logInWithReadPermissionsAsync(options);

      if (type === "success") {
        const credential = firebase.auth.FacebookAuthProvider.credential(token);
        
        // do the rest of your Firebase login logic
      }

      else {
        Alert.alert("", "There was a problem. Please try again.");
      }
    }
    catch (e) {
      console.log("e : ", e);
      Alert.alert("", e);
    }
  }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top