Expo Login Facebook "Sorry, something went wrong"

Hi guys,
I had a strange issue with the facebook login, executing the Facebook.logInWithReadPermissionsAsync
the application correctly open a popup asking "Expo" Wants to Use "facebook.com" to SignIn;
clicking on continue it always open a browser view with this message from Facebook:

Sorry, something went wrong.
We are working on it and we'll get it fixed as soon as we can.

this is the code (basically is the same of the documentation page)

import React from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import * as Facebook from 'expo-facebook';

export default function App() {
  return (
    <View style={styles.container}>
        <TouchableOpacity
            onPress={async () => {
                try {
                    await Facebook.initializeAsync('<facebookAppId>');
                    const {
                        expires,
                        type,
                        token,
                    } = await Facebook.logInWithReadPermissionsAsync({
                        permissions: ['public_profile', 'email', 'first_name', 'last_name']
                    });
                    if (type === 'success') {
                        fetch(`https://graph.facebook.com/me?access_token=${token}`)
                            .then((response) => response.json())
                            .then(user => {
                                console.log('login: get user data ok');
                            });
                    }
                    return false;
                } catch ({ message }) {
                    alert(`Facebook Login Error: ${message}`);
                    return false;
                }
            }}
        >
            <Text>Facebook Login</Text>
        </TouchableOpacity>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Also, I tried both SDK version 35 and 36 (with the obvious changes in the code) using the respective client version, but I obtain the same error.
I checked the configuration on facebook and seems correct.
Any idea on how to fix?
thanks

SDK Version: 35 and 36
Platforms(Android/iOS/web/all): ios (simulator and physical device), android (emulator and physical device)

1 Like

Login is working.

Thanks, for reply… but at now I obtain always the same message,
are there some specific settings on facebook app configuration?
To configure the app I use the instructions in expo docs

Sorry for late reply.
To register the app on facebook developer I followed exactly the instructions from this link
https://docs.expo.io/versions/v36.0.0/sdk/facebook/
there are some steps that I missing?

Finally found the solutions:

await Facebook.logInWithReadPermissionsAsync({ permissions: ['public_profile', 'email'] }); 

remove first_name, last_name from permissions array
and add them as query string parameters

 fetch(`https://graph.facebook.com/me?fields=email,name,id,first_name,last_name&access_token=${token}`) .then((response) => response.json()) .then(user => { console.log('login: get user data ok'); }); }
1 Like

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