facebookarchive / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
3.18k stars 1.96k forks source link

email return null for public email #771

Closed gaurvivek closed 7 years ago

gaurvivek commented 7 years ago

it returns email only for sdk registered user and return null for all users even if i login using email. $response = $fb->get('/me?fields=id,name,first_name,last_name,email,gender,education,birthday,location,picture,link', $accessToken);

but it returns null except my registered account.

tolbon commented 7 years ago

Do you check the user permission "email" ? You can only access email address of user who accept your app and your permission email. email is sensible information.

gaurvivek commented 7 years ago

I am doing this $accessToken = $helper->getAccessToken(); $response = $fb->get('/me?fields=id,name,first_name,last_name,email,gender,education,birthday,location,picture,link', $accessToken);

what should i do now? How to set permission.

tolbon commented 7 years ago

Do you have check email permission in your app dashboard -> app review ?

gaurvivek commented 7 years ago

yes I did. It shows green signal near email. I am adding here sniffed of my app page review pb

What else should I do?

tolbon commented 7 years ago

Did you try with your app in Graph API Explorer ?

gaurvivek commented 7 years ago

I am getting my own email not others. And Graph API Explorer works only for registered api accounts. (As i seen)

tolbon commented 7 years ago

You can only access email address of user who accept your app and your permission email.

gaurvivek commented 7 years ago

But when i log in with another account, it doesn't ask for permission.

gaurvivek commented 7 years ago

Here is sniffed of page when i first time login fb1

this is full list of permission and it doesn't ask for email.

fb2

tolbon commented 7 years ago

That's weird, I don't know. But that's the reason why you didn't have email. I prefer you ask on FbDevelopers Groups and close this ticket cause it's not a bug of sdk.

Thanks and sorry for didn't help you :(

gaurvivek commented 7 years ago

Already did.....here https://developers.facebook.com/bugs/241915622947783/ they recommended to notify here.

tolbon commented 7 years ago

Why you don't say that before ...

tolbon commented 7 years ago

Can you post here the encoded body and decoded body of the request when it's null ? $response->getBody()

This is for all of your account you test ?

tolbon commented 7 years ago

GET https://graph.facebook.com/USER_ID/permissions?access_token=USER_ACCESS_TOKEN

What the result of that request in curl or php sdk ?

gaurvivek commented 7 years ago

I found the solution. I haven't add proper permissions. Thank you for helping.

bopoda commented 6 years ago

I found the solution. I haven't add proper permissions. Thank you for helping.

Hi @gaurvivek, What do you mean?

mantissefr commented 6 years ago

Hi guys, I have to tell you a story following gaurvivek issue.

At a time, you could easily import your Facebook friends as name,email list in Yahoo contacts, of course, only friends who had a public email in their settings.

That's what I did with hundreds of friends I added from Groups I liked and wanted to work with.

I had a list of more than a thousand emails in few months thanks to this list (what a Facebook app can do).

I sent emails to my friends list, and an infopreneur answered me it is spam. I had further complaints about me being a hacker and was sacked of a Facebook group with no politeness.

I tried to explain that as we are friends on Facebook it is some kind of agreement to send an email and moreover, it is a public email on their Facebook about Page.

Nobody really knows if it is ok to get and send emails to their friends thanks to Facebook. Personnaly, I think that if Facebook allows it though the API, it is ok. Moreover, Facebook is now worldwide compliant with recent GDPR laws.

Whatever is possible through Facebook API is legal or permitted, that's what I wanted to say.

I love coding and I still do, but I am more into marketing now.

Cheers to the PHP-SDK for Facebook band !

All the best from France.

tolbon commented 6 years ago

Donc si tu me donnes ton e-mail j ai le droit de te spammer ? On peux voir ça comme je suis ami avec toi tu laisses tes clés sur ta voiture j ai le droit de la conduire du coup ? Après c est un email public du coup j ai droit de le spam. Non ! Oui mais on est amis sur Facebook. Perso a mes amis je les spams pas. au pire peut être t introduire via messenger ou via les groupes pour demander qui voudrait bosser avec toi. La gdpr est plus ou moins clair si tu n’a pas de la personne explicitement pour utiliser son email pour envoyer du démarchage tu es amendable sous le coup de la gdpr.

mantissefr commented 6 years ago

C'est quoi l'intérêt de partager son email publiquement si on n'a pas le droit de l'utiliser ? C'est pas logique.

Pour le parallèle de la voiture, c'est pas ça. La clé de ma voiture, c'est mon mot de passe pour accéder à mon compte email. Si tu m'écris, c'est que tu es passager et qu'on discute ensemble.

Ton idée, c'est plus si je te donne mon mot de passe.

Pour moi, envoyer du pourriel, c'est envoyer du contenu sans aucun rapport avec la relation que j'entretiens avec la personne à qui je m'adresse. Ou alors, faire du piratage.

C'est un débat sans fin, cette histoire de courriels publiques sur Facebook.

Salut.

Le jeu. 18 oct. 2018 à 08:13, Jean Baptiste Noblot notifications@github.com a écrit :

Donc si tu me donnes ton e-mail j ai le droit de te spammer ? On peux voir ça comme je suis ami avec toi tu laisses tes clés sur ta voiture j ai le droit de la conduire du coup ? Après c est un email public du coup j ai droit de le spam. Non ! Oui mais on est amis sur Facebook. Perso a mes amis je les spams pas. au pire peut être t introduire via messenger ou via les groupes pour demander qui voudrait bosser avec toi. La gdpr est plus ou moins clair si tu n’a pas de la personne explicitement pour utiliser son email pour envoyer du démarchage tu es amendable sous le coup de la gdpr.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/facebook/php-graph-sdk/issues/771#issuecomment-430887450, or mute the thread https://github.com/notifications/unsubscribe-auth/AJlQpTkAhUF9wpqjSQ0o4d0K6KH5g4ACks5umBwdgaJpZM4NIyDk .

gaurvivek commented 5 years ago

Hi @mantissefr , Thats not my story as I already mentioned above that I am not even getting pubic emails from facebook sdk.

mantissefr commented 5 years ago

Hi @gaurvivek that's because now Facebook is GDPR compliant.

mantissefr commented 5 years ago

However, you can get an email with a facebook login button for example, by asking permission to retrieve it !

alexander0205 commented 4 years ago

Hey guys I found the problem, taking long time find that, the problem result is you need set 'public_profile','email' this scope. public_profile: is basic information of the user. but email: is only the email of the user.

haris-aqeel commented 4 years ago

Hello I am getting photoURL but not able to see my profile picture in it. PhotoURL link is https://graph.facebook.com/1382654505272071/picture