Please provide the following:
- SDK Version: “expo”: “^42.0.3”, - “expo-facebook”: “~11.3.1”
- Platforms(Android/iOS/web/all): Android
- Add the appropriate “Tag” based on what Expo library you have a question on.
Hello!
I am having problems with the facebook login. I have followed step by step the guide about expo-facebook. I have tested a lot of different solutions but the error: “An error occurred while trying to log in to Facebook”, continues.
Hope some of you can help me.
My app.json
{
"expo": {
"name": "Prestadores",
"slug": Prestadores",
"version": "1.0.0",
"orientation": "portrait",
"userInterfaceStyle": "automatic",
"icon": "./assets/123.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"facebookAutoInitEnabled": true,
"facebookAppId": "123123",
"facebookDisplayName": "NAME",
"facebookScheme": "fb123123",
"notification": {
"icon": "./assets/123.png",
"color": "#FFA73F",
"androidMode": "default",
"androidCollapsedTitle": "Updates from Fuwu",
"iosDisplayInForeground": true
}
}
}
The error is only in android, because for iOS it is working properly.
My code:
let promise = new Promise(async (resolve,reject)=>{
try {
await Facebook.initializeAsync({
appId: '123123123', appName:'NAME'
});
await Facebook.logInWithReadPermissionsAsync({
permissions: ['public_profile','email'],
});
console.log('paso de login', res);
if (type == 'success') {
// Get the user's name using Facebook's Graph API
const response = await fetch(`https://graph.facebook.com/v11.0/me?access_token=${token}&fields=email,id,name,picture.type(large)`);
resolve(await response.json())
} else {
reject('error')
}
} catch (error) {
console.log('message error', error);
resolve(`Facebook Login Error: ${error.message}`);
}
})
return await promise