How can I retrieve Facebook User Info without Access Token - facebook

I found a good tutorial for building Facebook membership Authentication website which demo file is here > http://niftyandcrackerjack.com/sites/default/files/Test.zip
I wonder this example does not use access token to retrieve Facebook User Info. It use classes inherits from the masterpage. As I am new to ASP.NET, I don't know how to retrieve Facebook user info. Can someone give me and suggestion or explain...... Thanks,

My finding so far indicate that basic information cannot be accessed unless one has either 'userid' or 'username' as in this post.
If one has to try and fetch basic information using following url, then access_token is needed
http://graph.facebook.com/me

Perform an HTTP GET to https://graph.facebook.com/{userid} or HTTP GET to https://graph.facebook.com/{username}
Examples: Click the link below to see the JSON response.
https://graph.facebook.com/4
https://graph.facebook.com/zuck
Pretty cool, eh? And no token needed to get at this public info.
You can get more info on this here: https://developers.facebook.com/docs/reference/api

Related

Get user that made the comment in facebooks instagram graph api

Im building an application that manages comments for instagram business profiles, and i'm a little surprised that there doesn't seem to be a way to get info of the user who made the comment.
The docs seem to point this way too:
Reading a Comment
To read an individual comment's metadata, send a GET request to the /{instagram_comment_id} node and include any of the following fields:
...
user (only returned if the user making the query also made the comment)
So, am i to understand that there is no way to get the info of a user which made a comment on a media of the profile i manage or is there something i am missing? any help would be appreciated.
Thanks in advance
This url worked for me:
v3.0/{comment_id}?fields=id,timestamp,username,text
somehow I was able to get the username from graph API, but I'm not getting the fields name, profile_picture_url, etc. this is my URL for getting the username.
GET https://graph.facebook.com/v2.11
/123?fields=mentioned_comment.comment_id(456){user{id, username}, text}
123 - instagram_business_account id
456 - comment id
You can get full user details from username by Calling Instagram API(Maybe it's against there privacy policy). suppose stackoverflow is the username, by calling this API you will get full data.
https://www.instagram.com/stackoverflow/?__a=1

Facebook | Can't get profiles that are mentioned in a facebook profile post

I have an App that needs to query a users's profile post.
For any post, I'm trying to figure out:
the number of people (profiles) mentioned and
the names of the people (profiles) mentioned
Assume the user has already given the App access to view their profile data.
See here: https://developers.facebook.com/docs/graph-api/reference/v2.3/post
According to the documentation, if a user mentions 2 profiles, say "Friend1" and "Friend2" then I should be able to get back a response that includes the field:
which has some profile information for "Friend1" and "Friend2".
The problem I'm having is given the GET query
https://graph.facebook.com/v2.3/10207722160149556_10207755501343065
I get the response:
{:created_time "2015-11-08T09:29:54+0000", :message "Friend1 Friend2 testing again sorry just ignore", :id "10207722160149556_10207755501343065"}
I don't get a to field or for that matter a bunch of other information?
Does anyone know how I can get back what is listed in the documentation as what I should be getting?
Any help would be appreciated
In case this helps, these are the permissions I'm currently requesting:
["user_photos" "user_friends" "publish_actions"
"user_posts" "user_likes" "user_relationships"
"user_about_me" "email" "public_profile"
"user_tagged_places"]
Kind regards,
Jason.
Sorry, bad case of not reading the documentation and a library that I was using that got in the way.
I have to include a "field" query param to specify what I want returned.
After that and validating with a curl call I can get the information I need.

Empty response to API call to Facebook Graph

I have been hammering away at this problem for the last day. I really hope someone can help me out. I would be very grateful.
What I am trying to do is fetch event data from a Facebook Page. I looked over the documentation, which says this about reading Pages data:
Reading
A Facebook page
Permissions
For pages that are published, you need:
An app or user access token to view fields from fully public pages.
So what I did was I obtained an app access token via:
GET https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
which then returned
access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
After this I followed the documentation and made the following call
https://graph.facebook.com/v2.4/129511477069092/events?fields=id,cover,name,venue,description&access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
This returned:
{
"data": [
]
}
So after some fiddling around I was able to make the call by switching to version V2.2 and by creating an access key with Facebook API Graph explorer tool(no permissions granted).
GET https://graph.facebook.com/v2.2/129511477069092/events?
fields=id,cover,name,venue,description&
access_token=ACCESS_TOKEN_FROM_FACEBOOK_API_EXPLORER_TOOL
The page I am trying to retrieve data from is public and so are the events, so I can't figure out what is going on. I know I am super close since I am able to retrieve the data with the token provided by the Facebook API Graph Explorer Tool. The thing with using this token is that it only last a few hours and I need something that is going to last longer such as an app access token. I have done some research on Stackoverflow and found similar questions, but none of them solve my problem. Any help will be appreciated to the max! Thanks.
Looks like a bug of v2.4 to me. It works with v2.3 if you remove the deprecated venue field:
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.3
If the version is changed to v2.4, it returns an empty result.
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.4
There's no documentation about this in the changelog at
https://developers.facebook.com/docs/apps/changelog#v2_4
so I guess it's a bug. There's already a bug report at
https://developers.facebook.com/bugs/443054055873667/
with status assigned. If you have an app that supports v2.3, I'd suggest you prefix your request like this:
GET /v2.3/129511477069092/events?fields=id,cover,name,description

Facebook graph api - Unsupported get request

I'm creating a custom module in Drupal, that for part of its functionality must fetch posts from a business page. So for simplicity, I'm using fbapp module as a dependency (drupal.org/project/fbapp), so that I can use it's authentication and request functions (fbapp_app_authenticate() and fbapp_graph_request()) without having to worry about the constant facebook graph updates making my own code obsolete.
I've created a facebook app, so authentication should be app token, using appid and app secret. This seems fine and I'm getting back access_token. However, when I try to read posts from a publicly available page (the clients), I get the response:
"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api"
Here's the queries and responses my code produces:
graph.facebook.com/oauth/access_token?client_id=<redacted>&client_secret=<redacted>&grant_type=client_credentials
array(1) {
["access_token"]=>
string(43) "<redacted>|<redacted>"
}
graph.facebook.com/<page_id>/posts?access_token=<redacted>|<redacted>"
string(183) "{"error":{"message":"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100}}"
Can anyone verify a correct way to query a Facebook page programmatically, perhaps there's a setting in the page I'm querying that I need to set (although I can't find anything)?
If page restrictions apply, the page's feed can only be retrieved with an user access token as far as I know (because FB needs to evaluate the visibility criteria, and setting your app to the same restrictions doesn't help here):
See
https://developers.facebook.com/docs/graph-api/reference/v2.4/page/feed#readperms
It looks like everything you have done is correct. The response you got can be (i am not sure) because you got your clients pageid wrong.

Real-time updates Facebook app subscription issue

I have been trying to subscribe to real-time updates for the past week and I have been unsuccessful.
When I do the HTTP post (using rest-client) to URL:
https://graph.facebook.com/<app-id>/subscriptions
...I get this error message as response:
{"error":{"message":"(#100) The parameter object is required","type":"OAuthException"}}
My header parameters were as follows:
access_token=***,
object=user,
fields=friends,
callback_url=https://aaa.appspot.com,
verify_token=(app secret key)
I'm not able to find where I'm going wrong.
Somebody please kindly guide/help me figure my mistake.
The below link was used as a reference.
http://www.fb-developers.info/tech/fb_dev/tutorial/bytopic/realtime_upd_02.php
Thanks you for your time in advance.
You need to send your request to https://graph.facebook.com/appid/subscriptions and not https://graph.facebook.com/subscriptions - although that might be an error in your question and not your code!
EDIT: I just checked the markup for your question and you do have appid in the URL, it just wasn't displaying properly
How are you getting the access token? You must use an application access token and not a user access token, i.e. retrieve the access token from https://graph.facebook.com/oauth/access_token?client_id=<APP_ID>&client_secret=<APP_SECRET>&grant_type=client_credentials
https://developers.facebook.com/docs/reference/api/realtime/ is the official documentation, that might be more up to date than the link you've been using.