I am developing a Facebook app for a client. I want to add the client as a tester to the Facebook app so he can play around with it and give me feedback. The client and I are not friends on Facebook, so I am trying to add him by his Facebook ID, as instructed in the Add Tester modal.
Add Testers Dialog
When I enter his ID, I get a red x with the error message: "XXXXXXXXXXXX could not be resolved to a valid user ID or name." I have checked that the Facebook ID he gave me is correct via the Facebook Graph API Explorer.
How do I add him using his Facebook ID and get around this problem?
It seems that one must use the username of a person who is not their friend to register that person as a tester for your app. (Thanks #CBroe for asking me to try that.)
Unfortunately, the username field is deprecated in the Facebook Graph API for versions 2.0 and higher:
{
{
"error": {
"message": "(#12) username field is deprecated for versions v2.0 and higher",
"type": "OAuthException",
"code": 12,
"fbtrace_id": "GnJd8sMSb7l"
}
}
As far as I can tell, the best way to get the username from Facebook ID is to browse to https://www.facebook.com/{id} and grab the username from the redirected url, which will be https://www.facebook.com/{username}.
Related
I am developing an android app. I was using a HttpURLConnection to get profile pictures of facebook users. The URL looks like this:
http://graph.facebook.com/?ids=username1,username2,username3&fields=picture&type=square
But now, since v2.2 doesn't let me to get profile pictures of users who are not using my facebook app, it throws an error:
{ "error": {
"message": "(#803) Cannot query users by their username (username1)",
"type": "OAuthException",
"code": 803 } }
I am not interested in using "Facebook SDK for Android". Let's say I use a pop-up webview to authorize my facebook app. What url would let me do the same thing? Is there a simple solution like this:
graph.facebook.com/?app=APP-ID&ids=username1,username2&fields=picture
Since v2.0 of the API, you are not supposed to use usernames at all - and that´s why you can´t query users by their username anymore. The only way to get access to data of a user is by authorizing that user and using the /me endpoint.
Main rule: Forget about users who did not authorize your App, you are not supposed to get any data of those for privacy reason.
Is it possible to get name and photo from v2.0 app scoped Facebook id, without an access token?
This used to be possible in v1.0 (with original Facebook ids), see the link.
But in v2.0 with app scoped ids, I get this error:
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
This seems to me to be a common use case, where in a game, playerA is logged into Facebook and playerB is not using Facebook, and you want playerB to be able to obtain playerA's Facebook name and photo, without logging in.
That's intentional - in v2.0 no API calls can be made without an access token except the call to retrieve a user's profile picture
You should store the name in your own database, and retrieve the photo using the app scoped ID - since you'll already be deciding which users to show based on your own database you should already have both pieces of information in your system and not need to fetch anything from Facebook's API without an access token
In Graph API v1.0, I could get the profile picture of any user with the following call graph.facebook.com/{uid}/picture (fb doc).
In Graph API v2.0 facebook says it will return (a) app-scoped user ids for app users, and (b) temporary tokens for non-app users (through /me/taggable_friends and /me/invitable_friends api calls). Based on this, I would assume that the picture api call is deprecated in v2.0. However, the documentation makes it seem like there was not change to this call in v2.0.
Anybody knows if (full-size) public profile pictures of non-app users will be available in v2.0?
It is still possible to get a person's profile picture in v2.0.
http://graph.facebook.com/v2.0/APP_SCOPED_ID/picture will redirect to a picture of the user represented by that app-scoped ID.
If a user previously logged into your app when your app was coded against v1.0, they may still be known to your app by their original Facebook user ID. For this reason, http://graph.facebook.com/v2.0/ORIGINAL_USER_ID/picture will also still work.
/<user id>/picture does not require an access token in V2.0 and will work even when <user id> is an app scoped ID
The ID provided needs to be the user's actual ID or an app scoped IDthe response from /<user id>/invitable_friends or /<user_id>/taggable_friends won't work in the same way
Both of those APIs will also return you the full URL of the invitable or taggable user's photo
as part of the response, though.
It does work fine with original user IDs. For app-scoped IDs I haven't figured out how to use them.
While http://graph.facebook.com/v2.0/APP_SCOPED_ID/picture is supposed to work with the new app-scoped IDs, I can only get this response:
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
Note that this response is different from the response for completely invalid IDs. If you use an invalid user ID, you would get:
{
"error": {
"message": "(#100) No node specified",
"type": "OAuthException",
"code": 100
}
}
EDIT: As of May 10, 2014 this is a known bug.
The Graph API request that is currently working is
http://graph.facebook.com/v2.0/APP_SCOPED_ID?fields=picture
Trying to do a search through the Facebook API using the search of graph. I know that when logged into my personal email, I can search people via email address rather than their name.
http:///www.graph.facebook.com/search?type=user&q=myemail#email.com
Returns this:
{
"error": {
"message": "(#200) Must have a valid access_token to access this endpoint",
"type": "OAuthException",
"code": 200
}
}
Although I am using the API explorer which should work.
Any ideas? Is this not available anymore? I found other posts that had it working like this one
Is there a way to do this via FQL?
Facebook API does not allow search user by email.
I have an app with advanced permission for fanpages.
I was wondering, is there any way possible to add an admin to a fanpage through any API?
It's not possible with regular apps, the app must be whitelisted.
{
"error":
{
"message": "(#100) App must be on whitelist",
"type": "OAuthException",
"code": 100
}
}
Graph api for page
only gives the documentation about fetching admins but there's nothing about adding new admins.
But this should work (though, it gives me "app should be on whitelist" error)
POST admin_id field with valid facebook id to
https://graph.facebook.com/<page_id>/admins,
with a valid page access token (not user access_token)