Facebook Graph Api Oauth Change

Title: Facebook Graph API oauth change Date: 2011-06-08 17:37 Author: eamonnfaherty Category: development Tags: facebook, php Slug: facebook-graph-api-oauth-change

Facebook have changed their Graph API policy so that when you view a profile feed you need to have a valid oauth access token. See here.

Here is the PHP I used to get the feed of mypage.

[code lang=”php” ]
<?php

//config
$appId = “999”;
$appSecret = “I_LOVE_ROBOTS”;
$feedURL = “https://graph.facebook.com/mypage/feed”;
$limit = 10;

//script
$accessTokenUrl = “https://graph.facebook.com/oauth/access_token”;
$parameters = “client_id=$appId&client_secret=$appSecret&grant_type=client_credentials”;
$accessToken = file_get_contents($accessTokenUrl .  “?” . $parameters);

$parameters = “$accessToken&limit=$limit”;
$result = file_get_contents($feedURL . “?” . $parameters);
?>
[/code]

Published: June 08 2011

  • category:
  • tags:
blog comments powered by Disqus