react-native-facebook-login icon indicating copy to clipboard operation
react-native-facebook-login copied to clipboard

Could not to get email

Open thaiminhlien opened this issue 7 years ago • 4 comments

thaiminhlien avatar Sep 26 '17 12:09 thaiminhlien

Same problem here

Jose4gg avatar Nov 02 '17 13:11 Jose4gg

Same to me. There is no "email" info in the credentials object via the onLogin. There is no "public_profile" info also.

Found workaround/solution here

Dalamar avatar Nov 03 '17 17:11 Dalamar

Hi @Jose4gg , @Dalamar I found the solution and if anyone has the same problem there, go to https://developers.facebook.com/apps/ Select the name of your app. Select App Review from the left panel. And complete the "Submit content for approval" section and wait for facebook approval. Use this link for some tests

thaiminhlien avatar Nov 21 '17 12:11 thaiminhlien

FBLoginManager.loginWithPermissions(
    ['public_profile', 'email'],
    (error, data) => {
        if (!error) {
            const { credentials } = data,
                { token } = credentials,
                facebookGraphApi =
                    'https://graph.facebook.com/v3.2/me?fields=email&access_token=' +
                    token;

            fetch(facebookGraphApi)
                .then((response) => {
                    const { data } = response,
						{ email } = data;

                    console.warn(email);
                })
                .catch(() => {});
        } else {
            console.warn('Error:', error);
        }
    }
);

cassmtnr avatar Dec 26 '18 15:12 cassmtnr