An error occurred while trying to log in to Facebook

  1. SDK Version: “expo”: “~40.0.0”,
  2. Platforms(Android):
  3. Add the appropriate #facebook #sdk

An error occurred while trying to log in to Facebook

  • node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper
  • node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:35 in moduleName.methodInfo.name
  • … 9 more stack frames from framework internals

I also tried deleting node modules and installing it again but again and again I keep getting the same error.

initializeAsync works fine but
const data = await Facebook.logInWithReadPermissionsAsync({
permissions: [‘email’],
});
This always throws an error mentioned above on Android.
iOS it is working fine

            await Facebook.initializeAsync({
                appId: <secret>,
                appName: 'AwesomeProject',
                autoLogAppEvents: true
            })
            const {
                type,
                token
            } = await Facebook.logInWithReadPermissionsAsync({
                permissions: ['public_profile'],
            });            
            if (type === 'success') {
                // Get the user's name using Facebook's Graph API
                const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`);
                console.log(await response.json())
            } else {
                // type === 'cancel'
            }

I also tried the solution an-error-occurred-while-trying-to-log-in-to-facebook/50785
But it did not work

Full error

Hey @badal897, is this occurring on a physical Android device or an emulator? Also, can you let me know what version of Expo Go you are running?

Cheers,
Adam

Hey @adamjnav,

This is coming on the real device. The expo version I am using is 4.2.1. Expo sdk 40.

List of dependencies

    "@expo/react-native-action-sheet": "^3.8.0",
    "@react-native-async-storage/async-storage": "^1.14.1",
    "@react-native-community/checkbox": "^0.5.7",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/drawer": "^5.12.4",
    "@react-navigation/native": "^5.9.3",
    "@react-navigation/stack": "^5.14.3",
    "axios": "^0.21.1",
    "dayjs": "^1.10.4",
    "expo": "~40.0.0",
    "expo-constants": "~9.3.3",
    "expo-document-picker": "~8.4.1",
    "expo-google-app-auth": "^8.1.4",
    "expo-image-picker": "~9.2.0",
    "expo-linear-gradient": "~8.4.0",
    "expo-permissions": "~10.0.0",
    "expo-status-bar": "~1.0.3",
    "formik": "^2.2.6",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-appearance": "^0.3.4",
    "react-native-bottom-toolbar": "^4.3.0",
    "react-native-countdown-component": "^2.7.1",
    "react-native-crypto-js": "^1.0.0",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-image-crop-picker": "^0.36.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-loading-spinner-overlay": "^2.0.0",
    "react-native-modal": "^11.7.0",
    "react-native-paper": "^4.7.2",
    "react-native-reanimated": "~1.13.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.2",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-stars": "^1.2.2",
    "react-native-web": "^0.15.3",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-redux": "^7.2.2",
    "reanimated-bottom-sheet": "^1.0.0-alpha.22",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.9",
    "redux-thunk": "^2.3.0",
    "yup": "^0.32.9",
    "expo-secure-store": "~9.3.0",
    "expo-facebook": "~9.1.0"

What I tried -

  1. Deleting node modules and npm install them again.
  2. Creating a new expo blank app and installing expo-facebook again.

Eventually none of them worked. I still got the same error on android.

Did you find any the solution?

I have exactly the same problem. It works on IOS, but not on Android.

“expo”: “~41.0.0”,
“expo-facebook”: “~11.0.5”,

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.