How to authenticate with OAuth for Group Posting - facebook

To be able to post to a group page I need an oauth access token that lives forever. Is the only way to do this is to create a Facebook app and use the client-id of it and other parameters to grab this? How do I give permission to the app to post to the actual group though? If someone can list the steps on how to do this, that would be great.

Facebook access_token lifecycle (including extension/refresh, etc) are well documented here: https://developers.facebook.com/docs/facebook-login/access-tokens#extending

Related

facebook permernant access token user_posts?

I have no idea about how facebook tokens or APIs work, so please excuse my ignorance.
I am trying to get a access token to display my posts to my wall. My website is www.quadscene.co.nz and on the homepage I am trying to display all posts to wall.
I have created a access token using some tools within facebook, but they expire within about 2 hours, these token work fine when selecting the user_posts option or permission, however all other access tokens ive tried do not display posts.
I think its using OAuth.
Is there a way to create a token that will not expire? and has the user_posts permissions?
Thanks in advance!
You need to read the docs to understand how OAuth works and what different access tokens are available.
Specifically, you need to look at the long-lived tokens.

Facebook long-lived accesstoken for a page

I'm using a facebook extension in TYPO3 to pull out the facebook posts of a page. Therefor I need the accesstoken.
I googled around and found that I need a facebook app and I need to be administrator of the page.
Then I heard that I need to connet the app with the site, but how can I do this?
I also tried to get accesstoken:
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials
And then performing:
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token& client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-token}
... with this token but it says No user access token specified
Can someone help me step by step how to get the long lived token?
As you just want to pull, you really don't need a page access token. Until and unless you have a demographic or other restriction over your page. All the pages are Public and data over them can be easily accessed by using the App Access Token which is simply put
Your_App_ID|Your_App_Secret
first u need to get an API key from facebook, so here are the steps--->
http://www.shoutmeloud.com/how-to-acquire-your-facebook-api-key.html
& then u can access facebook API, these are docs provided by the facebook to use that API--->
https://developers.facebook.com/docs/guides/web/
This was my implementation (PHP):
$newposts = json_decode(file_get_contents("https://graph.facebook.com/YOURFBPAGE/feed&access_token=YOURAPPID|YOURAPPSECRET"));
Since I was only using this to make simple pull request of my feed posts this is the best way to do it. You don't have to deal with expiring access tokens. Just create your facebook App and get the ID and secret.

Can a page on a website get a facebook access token?

I'm fairly new to facebook development and I still get confused about the oAuth thing.
A client of mine asked me to show the latest posts, links and statuses of his facebook page to his website.
On the a php page on his website I'm creating a url
"https://graph.facebook.com/".$clientFacebookPage."/posts?limit=1&access_token= xxx
In order to json decode it and display the info I want, but I don't know how to get an access token. I generated an access token with the graph explorer that is tied to my name as a facebook developer but that expires in 2 hours.
There are many thing that confuse me already and I hope you can point me towards a solution
I've read the documentation but everything revolves around users getting logged on your app and you app posting. So my questions are:
Do I need to create an app to do a curl (requiring special permissions) using the http://graph.facebook/xxxx url?
If so, does the adming of the facebook page need to authorize with the app?
What do I need to do next? I can create a web page using the app id and secret. Does that mean that I can retrieve the info of the facebook page? How?
I know that the page needs an auth token to curl the http://graph.facebook/xxxx page and retrieve the data needed. Where can I generate it? Does the webpage need to generate it, or do I have (as the app developer) acquire the token and write it to my php code?
If I log out of the facebook, will the program/webpage stop functioning?
I hope I didn't confuse you.
Thank you.
The basic process for obtaining an access token for a Page is as follows:
1. Get a user access token for a User who is an admin of the Page
2. Using this User token, request graph.facebook.com/me/accounts and look for the correct Page ID in the list returned.
3. Grab the associated Page token from that ID
4. Use it to do Page stuff.
There is a newly launched Facebook docs guide which shows you how to obtain one of these access tokens in a step-by-step fashion:
https://developers.facebook.com/docs/howtos/login/login-as-page/
Hopefully that guide should help you.
I will also answer your questions in order:
Yes, you will need an app in order to generate access tokens to make API queries
Yes
This is in the guide linked above (start at the Getting Started if you need to create a way to get a User Access Token also)
Again, see the guide above
Yes, but you should follow the steps in this guide to generate a long-lived access token. Once you do that, any Page token you retrieve will last forever.

Get foursquare place details with/without API

I want to know the best way how to obtain the basic info of a foursquare location, so for instance the mayor, total checkins, profile picture,...
Important: I should be able to get this information without providing an oauth_token, and that exactly is my problem. The API demands a token, but I figured it should be possible to get the data without the token, because you can access places without authenticating.
E.g.: https://foursquare.com/v/whole-foods/49bc3b0af964a52020541fe3
The reason I want to do this, is because I want to make a facebook application which fetches the data for a locationbased facebook page and I don't want to demand the facebook users to login to foursquare first.
An alternative is webscraping, but that really is my last option.
Thanks in advance for your responses.
The "Venues Platform" allows you to access venue information through the API without an OAuth token. You can access all the information you're looking for, all you need to do is supply your Client ID and Client Secret when making a request to the /venues API endpoint.

Get facebook comments with the graph api without user authentication

I'm building a flex application using the http://code.google.com/p/facebook-actionscript-api/ library.
Is it possible to get all the comments for an OBJECT_ID (https://graph.facebook.com/OBJECT_ID/comments) without the current user being logged in facebook. If it is, please tell me what the OBJECT_ID needs to be (post in public group or something else).
Thanks in advance.
blz
You need to request the offline_access permission. It will give you an access token that won't expire. Save it in your database and use it for your connections and it will work without the user.
More: http://developers.facebook.com/docs/authentication/permissions/
I believe Object_ID is the user, and they do not have to be logged in for you to acquire this
But...
What you probably will require is authentication of your request. I believe FB now requires that you register your webapp with them to get the necessary OAUTH signature. I think this is as of F8 2010.