facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

Can't get user Email #737

Open admin2684 opened 4 years ago

admin2684 commented 4 years ago

Hi I 'm using your wallpaper on my application on Android and my code is blow . I can't get the email of user thought GraphRequest.

`const getFacebookUserInfo = () => { const responseInfoCallback = (error, result) => { if (error) { console.log('Error fetching data: ' + error.toString()); } else { Log('Success fetching data: ', result); } };

const param = {
  fields: {
    string: 'email',
  },
};
// Create a graph request asking for user information with a callback to handle the response.
const infoRequest = new GraphRequest(
  '/me',
  {
    httpMethod: 'GET',
    version: 'v2.5',
    parameters: param,
  },
  responseInfoCallback,
);
// Start the graph request.
const res = new GraphRequestManager().addRequest(infoRequest).start();
Log('Res is :', res);

};`

In my response is :

Success fetching data: {id: "..."}

I can't see email parameter in response

MTTenterprise commented 4 years ago

Seems like the have updated the Loginbutton component

you should change <LoginButton readPermissions={["email"]}

to <LoginButton permissions={["email"]}

Everything should be working right after