PHP Classes

Facebook not returning email

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  Facebook not returning email  >  (Un) Subscribe thread alerts  
Subject:Facebook not returning email
Summary:PHP OAuth API
Messages:31
Author:victor
Date:2015-11-28 04:08:41
 
  1 - 10   11 - 20   21 - 30   31 - 31  

  11. Re: Facebook not returning email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-04 23:45:07 - In reply to message 7 from Scott Kallen
Could it be the case that you supplied your phone number as main authentication for login to Facebook instead of your email address?

  12. Re: Facebook not returning email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-04 23:54:40 - In reply to message 7 from Scott Kallen
Well Facebook clarified that sometimes it is not possible to provide the email for certain reasons. Could any of the reasons be your case?

- No Email address on account
- No confirmed email address on account
- No verified email address on account
- User entered a security checkpoint which required them to reconfirm their email address and they have not yet done so
- Users's email address is unreachable

  13. Re: Facebook not returning email   Reply   Report abuse  
Picture of victor victor - 2015-12-05 01:18:21 - In reply to message 12 from Manuel Lemos
I have tried using facebook sdk and have managed to retrieved email, so should not be facebook restriction cos using my own account which is pretty standard.

  14. Re: Facebook not returning email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-05 01:40:49 - In reply to message 13 from victor
What exactly is the value that you are setting the OAuth class scope variable?

  15. Re: Facebook not returning email   Reply   Report abuse  
Picture of victor victor - 2015-12-05 01:49:45 - In reply to message 14 from Manuel Lemos
in facebook sdk, I added permission for email in getLoginUrl and in the response $response = $fb->get('/me?fields=id,name,email', $accessToken);

I was able to get the email.

  16. Re: Facebook not returning email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-05 02:09:48 - In reply to message 15 from victor
No, I mean when using the PHP OAuth class. What exactly did you put in the scope variable?

Also in the CallAPI function, did you use this URL

graph.facebook.com/v2.3/me

Or this URL?

graph.facebook.com/v2.3/me?fields=i ...

  17. Re: Facebook not returning email   Reply   Report abuse  
Picture of victor victor - 2015-12-05 03:27:43 - In reply to message 16 from Manuel Lemos
I used the facebook login example from PHP OAuth API and did not modify anything. I saw that the email scope was added.

  18. Re: Facebook not returning email   Reply   Report abuse  
Picture of Scott Kallen Scott Kallen - 2015-12-05 03:28:02 - In reply to message 16 from Manuel Lemos
In this instance, I am running your stock, relatively unmodified (I change the require for the httpclient to match our structure.)

Here's the code (you should recognize it, I think):

/* API permissions
*/
$client->scope = 'email,publish_actions,user_friends';
if(($success = $client->Initialize()))
{
if(($success = $client->Process()))
{
if(strlen($client->access_token))
{
$success = $client->CallAPI(
'https://graph.facebook.com/v2.3/me',
'GET', array(), array('FailOnAccessError'=>true), $user);


And here is a simple presentation of the screen-by-screen steps I took. This is what I *THINK* I did:

docs.google.com/presentation/d/1Lg6 ...

Scott.

  19. Re: Facebook not returning email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-05 03:41:19 - In reply to message 18 from Scott Kallen
I suggest starting over calling ResetAccessToken and only ask for the email scope. For using publish_actions your application must go through review, so I would not add that scope until your application is approved.

You can read more about it here:

phpclasses.org/blog/post/273-5-Urge ...

  20. Re: Facebook not returning email   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-12-05 03:48:37 - In reply to message 17 from victor
The only difference between the Facebook SDK and this class is that Facebook SDK always pushes the latest API version which v2.5.

So if you start over calling ResetAccessToken and then change the script to set after calling Initialize the dialog_url to use v2.5 and use call the API using the v2.5 URL with the fields parameter, it will be exactly like the Facebook SDK.

$client->dialog_url = 'https://www.facebook.com/v2.5/dialog/oauth?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&scope={SCOPE}&state={STATE}';

$success = $client->CallAPI( 'https://graph.facebook.com/v2.3/me?fields=id,email,name', 'GET', array(), array('FailOnAccessError'=>true), $user);

Still I think that it is a glitch in Facebook API because I have seen a lot of people complaining of eventually missing the email address without a consistent explanation.

 
  1 - 10   11 - 20   21 - 30   31 - 31  
For more information send a message to info at phpclasses dot org.