Facebook access token for User Home Town batch request - facebook-graph-api

Is it possible to get user hometown using facebook Graph batch request for around 1000 users? What accesstoken needs to be sent and how can I get that access token?
Thanks in advance,
Ravi.

With a user access_token you can retrieve the active user's hometown if you have asked for the user_hometown permission. You can also retrieve the active user's friends hometowns if you have asked for the friends_hometown permission.
https://developers.facebook.com/docs/authentication/

Related

How to Generate Access Token without App_Id and App_Secret for Facebook API?

I am reviewing ways to create Access Token for Facebook API, until now I was creating User Access Token via tool to access reports. Afterwards, I was able to create an Access Token with the redirect_uri without having to go to the tool. While doing this I have to ask the user for app_id and app_secret.
Here's what I did:
client = Client(<APP_ID>, <APP_SECRET>)
url = client.authorization_url(<REDIRECT_URI>, 'STATE', <[SCOPE_LIST]>)
response = client.exchange_token(<REDIRECT_URI>, <CODE>)
response['access_token']
Here, when the user is directed to REDIRECT_URI, he can get access tokens with CODE. But it needs to enter the app_id and app_secret itself constantly. I want to automate this process for individual applications that everyone has access to in a bulk user login. Is there a way to automatically get the app_id and app_secret from the user here? I mean, can we get app_id and app_secret information from the user automatically when he logs in with his account?

Example for Facebook graph URL

I am trying to get my Meteor app to save user_birthday and email in MongoDB. All I am asking for is an example for a URL that queries Facebook Graph for user_birthday and email by providing a facebook user ID and the corresponding access token. The perfect answer would be a link were I just copy my user ID and access token and it gives me my email and my birthday.
Thanks in advance :)
This would be the API call: /me?fields=email,birthday&access_token=[your-user-token]
https://graph.facebook.com/me?fields=email,birthday&access_token=[your-user-token]

Facebook: Get User Access Token using Facebook.Json

I have some C# code that retrieves an access token using Facebook.JsonObject and can post to my profile wall on facebook with no problems.
However, if I try to use that same access token to retrieve details of my facebook business pages so I can post to them, then I get the message "user access token is required to request this resource".
I thought the access token I had retrieved that allowed me to post to my profile was a user access token. What is the difference, and how do I get a user access token?
This is the code I am using to get the access token:
facebook.JsonObject AuthResult = (Facebook.JsonObject)Oauth.GetApplicationAccessToken(parameters);
object Access_Token = "";
AuthResult.TryGetValue("access_token", out Access_Token);
FacebookClient FBClient = new FacebookClient(Access_Token.ToString());
More information:
I need my customer's c# application to post directly to my customer's facebook business page via code without the application "allow access" box popping up and any redirects to applicatoins taking place. Therefore I need to get the User Access Token programatically without facebook being logged in or open etc.
Any (non-sarcastic) help very gratefully received.
Thanks
I thought the access token I had retrieved that allowed me to post to my profile was a user access token.
Does that method name,
(Facebook.JsonObject)Oauth.GetApplicationAccessToken(parameters);
===========
really sound to you as if it was supposed to give back a user access token? Sorry, but to me it doesn’t …
If you are not familiar with the different types of authentication and access tokens, please read this first: https://developers.facebook.com/docs/authentication/

How to publish to a feed if you have offline_access permission

I am trying to publish to a user's FB account, and I have the following permissions:
* offline_access
* publish_stream
But when I try to post to the user's account, it appears that FB is asking me for an access token (which I don't have).
Does anyone know the structure of the URL to publish to a FB user's stream when you don't have an access token?
Thanks
Do an HTTP POST to /userID/feed?access_token=appID|appSecret
You need to have your app login. About 2/3rds of the way down on the authentication documentation, there are instructions on how to get a session access token for your app.
https://developers.facebook.com/docs/authentication/
Basically, just hit this url:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
And you will get back an access token you can use to post to any user's wall that your app has permission for.

working with facebook Graph API

I was reading about FB Graph API in this page. Please see the section Authorization
They say that
At a high level, you need to get an
access token for the Facebook user.
I am confused. How do i get the logeed in users access token in my website
https://developers.facebook.com/docs/reference/api/
You don't get a logged in user's access token. Once a user is authenticated, you receive an access token to be able to see/manipulate that user's data, depending on what permissions you have requested from that user.
This is well documented in the "Authentication" section of the developer documentation: https://developers.facebook.com/docs/authentication/