Please provide the following:
- SDK Version: 38
- Platforms(Android/iOS/web/all): IOS
I am facing a crash issue when trying to implementing Facebook login using expo in IOS.
Please find my code below:
debugger;
await Facebook.initializeAsync("<APP-ID>").catch((error)=>{
alert(`Facebook initializeAsync: ${error}`);
});
const result = await Facebook.logInWithReadPermissionsAsync({
permissions: ["public_profile", "email"],
}).catch((error)=>{
alert(`Facebook logInWithReadPermissionsAsync: ${error}`);
});;
this.setState({ isLoading: true });
if (result.type === "success") {
// Handle successful authentication here
await Axios.get(
`https://graph.facebook.com/me?access_token=${result.token}&fields=id,name,email,picture.type(large)`
).then(async (response) => {
console.log(response.data);
const { picture, name, email, id } = response.data;
await upsertUserData(0, id, name, email, '', '', '', picture.data.url, 1, 1, Date.now(), response.data);
}).catch((error) => {
console.log(error);
alert(`Facebook Graph API Error: ${error}`);
}).finally(() => {
this.setState({ isLoading: false });
});
} else {
// Handle errors here.
alert(`Facebook type returned: ${type}`);
this.setState({ isLoading: false });
}
} catch ({ message }) {
alert(`Facebook Login Error: ${message}`);
}
package.json
“expo”: “^38.0.0”,
“expo-av”: “~8.2.1”,
“expo-constants”: “~9.1.1”,
“expo-facebook”: “~8.2.1”,
“expo-font”: “~8.2.1”,
“firebase”: “7.9.0”,