Please provide the following:
- SDK Version: 35
- Platforms(Android/iOS/web/all): iOS, maybe Android too?
iOS users getting error when logging in with expo-facebook. I set it up like the docs, just replaced with my app ID.
I used the setup from:
https://docs.expo.io/versions/latest/sdk/facebook/
Code:
async function logIn() {
try {
const {
type,
token,
expires,
permissions,
declinedPermissions,
} = await Facebook.logInWithReadPermissionsAsync('<APP_ID>', {
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}`);
Alert.alert('Logged in!', `Hi ${(await response.json()).name}!`);
} else {
// type === 'cancel'
}
} catch ({ message }) {
alert(`Facebook Login Error: ${message}`);
}
}
The error they’re getting is the caught error. The message variable is “Error with Facebook login”. I don’t see the same error with my own testing. Not everyone gets that error.
Any idea how to debug/fix?
Side note: Also noticed that for Android, I click log in when returning and it straights login… while for iOS, it seems to pop up a WEB viewer, where you can click to use the app, and then logs you in?