I'm trying to access a public facebook page's posts with the Facebook API but I cant seem to authenticate even with all the right credentials. FB.api returns:
{"error":{"type":"http","message":"unknown error"}}
and there's an error logged in 'access token 1: line 1'
Uncaught ReferenceError: TRJg376YTvXfk6sMur4Mggh5YnU is not defined access_token:1
(anonymous function)
Here's the code I'm using:
<script src="http://connect.facebook.net/en_US/all.js"></script>
<div id="fb-root"></div>
<button name="my_full_name" onclick="connectToFacebook()" value="My Name" />
<script>
function connectToFacebook() {
FB.api('https://graph.facebook.com/oauth/access_token',
'get',
{client_id:'xxxxxxxxxx', client_secret:'xxxxxxxxxx',grant_type:'client_credentials'}, //client_credentials
function(response) {
alert(JSON.stringify(response));
});
FB.api("/publicpage/feed",
function (response) {
console.log(response);
});
}
</script>
it's not very well documented on their site! any ideas?