Graph API incorrectly returning empty array - facebook

I'm trying to run a simple query on the graph api. I just want to pull back the id of a user based on the email address they use to login to facebook.
I am using the following query:
https://graph.facebook.com/search?q=facebook.xxx#xxx.xid.au&type=user&access_token=AAADxxxxT64Q8BADcpCdWBojPXPLbZBsSjzj8LPUPhyYJMGWaRuZAP56wIR4BaiUZAaPZA22Ex2y7bgBQHTxxxxxxxxxxxx
and am getting the following in response (no errors, no data)
{
"data": [
]
}
I know the email address is valid - it is my own. This query had worked fine in the past. Any tips on where I should look to for debugging?

https://graph.facebook.com/search?q=facebook.xxx#xxx.xid.au&type=user
Due to privacy concerns searching by email address has been disabled.
However, if you have a user who has granted you email permissions, you can get their email address, however you are limited as to what you can use that email address for.
EDIT
It was filed as a bug (https://developers.facebook.com/bugs/292220680814266) and now is resolved.
Looks like Facebook has caved in to peer pressure and is now allowing this search to happen again.

I think you have no permission to access user's data.
see https://developers.facebook.com/docs/reference/api/permissions/ for more details

Related

How can I get owner email for a Facebook App using the App Access Token

How would I get the email address associated with an active Facebook App ID, if all the usual methods (such as here, and here) don't return any email information with my creator-uid?
(I simply don't get the email field returned, even when I specifically request it as per here. I don't think this is a case of this as I didn't get an "App has no owner" error, or any error whatsoever.)
I've also tried this, but I'm in a catch-22 as I can't log in to select the application first.
I'm looking for the owner email address, so I can log in to make administrative updates following graph API updates.
Other specifics:
I get the following when I hit the Graph API via: https://graph.facebook.com/{my-app-id}?access_token={my-access-token} or https://graph.facebook.com/{my-app-id}?access_token={my-access-token}&fields=email
{
"name": "my-name",
"id": "my-creator-uid" }
I've tried to recover my FB account using all emails I can think of, but FB says 'no account exists' for each that I try. (This is a data-analytics corporate account being used to gather data for 12+ months, so I can't simply create a new account/app ID and start using that instead, as app-scoped user IDs will change.)
I've also tried viewing https://www.facebook.com/app_scoped_user_id/{my-creator-uid}/ and https://www.facebook.com/{my-creator-uid}/ from another company FB account, but both get:
Sorry, this content isn't available right now The link you followed
may have expired, or the page may only be visible to an audience
you're not in.
What else would you suggest? What might have happened? I've tried to contact Facebook, but that search led me to this forum post, so I'm here. Thank you in advance for your help.
This is not a programming question, try to get in touch with the Facebook Team, if you are working with Facebook paid services (like Advertising) you might have an account representative that can accelerate the things a little bit (But this can be a really long wait).
A more realistic option is to create a new profile and an new app, also your application will be reviewed as well (Take a little less time than previous option).

Email extended permission not granted in some cases

I am using the server-side authentication flow, and when requesting the email extended permission, once in a blue moon the email address is not sent back, causing my application to break.
That information is required for my application to function properly, so I will modify it to re-prompt the user. But I would like to understand why/how this happens since I cannot find any way to revoke that permission from the application when authorizing. The dialog states that the permission is required. Is this because of accounts belonging to minors that can't give out that information?
I'm requesting like so: https://www.facebook.com/dialog/oauth/?client_id=$appId&redirect_uri=$fbAuthUrl&state=$stateString&scope=email
It's possible that some users simply won't have an email - Earlier, it was possible to sign up for Facebook with a cell phone only - I'm not sure if there's some other reason or, it could be a bug with the API
After much head banging, I found this bug filed with Facebook that I think is responsible:
https://developers.facebook.com/bugs/487563591260030

Facebook Graph API returning numbers instead of email addresses

I'm using Facebook Connect along with the Facebook Graph API to fetch user's email addresses when they sign up to my site. This works perfectly over 99% of the time but sometimes when I query the Graph API for a user's data after they have given my site permission, including the email permission, Facebook returns a large number (eg. 14036774009) as the person's email address.
So far, the numbers are always different and are always 11 digits long and all the other user data from the Graph API is valid. I've never been able to replicate this problem with a Facebook account that I control.
In some ways, the large number reminds me of the random proxy email addresses that Facebook generates for people who opt to give 3rd party apps a forwarding address instead of their main address (the proxy addresses look something like this: apps+148742679521093.617890126.8a2b26037e1ccd06bb81aaec5925f4c7#proxymail.facebook.com)
Can anyone explain this behavior or a way to fix it (and always get valid email addresses)?
It's a bug. Has already been reported to Facebook:
https://developers.facebook.com/bugs/298946933534016
It seems to be happening even when using the graph explorer - https://developers.facebook.com/tools/explorer, but only for some users. In my case about 0.2% of the time.
So until it is fixed you have 2 options:
If Facebook gives you a bad email value, ask the user for his/her email manually.
Save the long lived access token and try again periodically to see if you get the correct email back.
Are you still using the old auth dialog somehow?
The ability to provide a proxy email address is only in the old auth dialog
This happens for people who sign up to Facebook with their mobile phone number and the number returned is just that.
There is no option to get at the users' email address because he may not have given it to Facebook yet.

Twitter - get user_id or screen_name querying by user e-mail

I'm trying to get the user_id or screen_name querying per e-mails on Twitter.
We have a website and also a database of users. I have also all user's e-mail and I'd like to query if they have a Twitter account, and if so, get the screen_name or user_id....
I've read all twitter api documentation and it seems that I can query user only per screen_name or user_id...
http://apiwiki.twitter.com/w/page/24142947/Twitter-REST-API-Method:-users-lookup
https://dev.twitter.com/docs/api/1/get/users/search
Based on this query: api.twitter.com/1/users/lookup.xml?user_id=1401881,1401882
I tried this: api.twitter.com/1/users/lookup.xml?email=[e-mail]
Then I got this:
"Client application is not permitted to search with specified terms"
So it seems that Twitter knows this parameter "email" (otherwise it should show a error message)
Any idea?
That query is probably an internal method, if it's a method at all. Can't you just ask your users for a Twitter handle if they have one? Apparently when they did allows public access, it was mostly used for spam. Ultimately, there's no real need to have to find a user's Twitter handle by email when balanced out with the misuse that could be possible. According to the bottom of this post, there may be something coming in the future for authenciated partners.

Facebook Callback JSON does not return email sometimes

Facebook Graph API.
I am requesting email permission and it works all fine except for some users, the json does not return email field. I am not sure why this happens. The code is same and it works great for all users, returns email field except 1 in 100 or so users where it does not have this field in json. All other fields are there.
Has anyone faced this problem before ??
I checked the facebook privacy settings and there is nothing that prevents email from coming in json if user grants email access to facebook app, yet this is happening to me. I searched the net and no one else seems to be facing this issue.
Any hint would be appreciated
Never makes assumptions about what Facebook will send you, never expect every field to be present and never expect a Graph request to do what you want.
Facebook sometimes do things like this, a missing field here and there, a cryptic and unexpected error somewhere elseā€¦ While it can be no harm be aware that it also happens in critial places like in the signed_request sent when an user launches an app.
You also have to know that 'your' Facebook may not be everyone else's Facebook. They do geographic and somewhat random deployments of their code. An option to hide your e-mail address to every application could appear for someone but not for someone else, without any particular reason.
Considering your particular issue, I doubt there is an option to hide you e-mail address to an app who has the mail permission, but if the permission is not mandatory someone could accept your app and cherry-pick optional permissions later.
I dealing with this issue recently. Apparently, facebook only promise to return "valid email" address. Some account do not having any "valid email". They can be account who using phone for validation, or account that email is expired. I tried with a account which email, lets said "xxxx.gmail.com" is expired, when query that account graph, i unable to get any email shows(by using facebook debugger). However, when i login xxxx.gmail.com in gmail, and re-activate the email, and i query graph api again for the account, it able to return me email.
had the same issue for a while, which caused some heavy head banging against the wall.
in my case the issue was due to the fact that some users have unverified emails or no email at all (when signing up via mobile/SMS).
in this case facebook will not provide an email on the response.
from the facebook docs:
note: this field will not be returned if no valid email address is
available for the user
sources:
https://github.com/mkdynamic/omniauth-facebook/issues/61
Register with Facebook sometimes doesn't provide email (sebastian's and colm's answers)
https://developers.facebook.com/docs/reference/api/user/
The only thing that worked for me was requesting for permitted fields through the API:
FB.api("/me", {fields: "email,..."}, callback)
This totally fixed the issue.
Hope that helps.