Problem with facebook integration using Expo

My piece of code shown below:

fbSocialLogin = async () => {
try {
const { type, token } = await Facebook.logInWithReadPermissionsAsync(
“582284132122368”,
{ permissions: [‘email’, ‘public_profile’] }
);
switch (type) {
case “success”: {
console.log(token);
const response = await fetch(https://graph.facebook.com/me?access_token=${token});
const profile = await response.json();
console.log(JSON.stringify(profile));
return profile;
break;
}
case “cancel”: {
return “cancel”;
break;
}
default: {
return “failed”;
}
}
} catch (error) {
alert(error.message);
}
};

It return only name and id params but according to permission its not return full response please help me sort out this problem …

Hey @kulbhushansingh,

I would suggest reading through the Facebook Graph API docs so you can better understand how to fetch things: Graph API - Documentation - Facebook for Developers

For instance, if you wanted to get a user’s name and picture your fetch should look like this fetch( https://graph.facebook.com/me?access_token=${token}&fields=id,name,picture.type(large)`)` with the added fields parameters.

Cheers,

Adam

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