Some of the features in Facebook Graph API requires a special kind of tokens called “app access token“. Features like Facebook Test Accounts and Facebook Insights make use of this token.

So how to obtain a Facebook Application access_token?
This can be easily achieved using file_get_contents():

$APPLICATION_ID = "APP_ID";
$APPLICATION_SECRET = "APP_SECRET";

$token_url =	"https://graph.facebook.com/oauth/access_token?" .
				"client_id=" . $APPLICATION_ID .
				"&client_secret=" . $APPLICATION_SECRET .
				"&grant_type=client_credentials";
$app_token = file_get_contents($token_url);
Back to top