Skip to content

Instantly share code, notes, and snippets.

@tcelestino
Created September 4, 2012 00:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcelestino/3615124 to your computer and use it in GitHub Desktop.
Save tcelestino/3615124 to your computer and use it in GitHub Desktop.
Permissions app on page tab Facebook
<?php
require 'sdk/facebook.php';
$fb = new Facebook(array(
'appId' => 'APP_ID',
'secret' => 'SECRET_APP_ID',
));
$user = $fb->getUser();
if ($user) {
try {
$profile = $fb->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
if($user) {
$logoutUrl = $fb->getLogoutUrl();
} else {
$app_id = $fb->getAppID(); // id da app
//seto as permissões app
$loginUrl = $fb->getLoginUrl(
array(
"scope" => "email, user_photos, read_friendlist",
"redirect_uri" => "https://www.facebook.com/pages/YOU_PAGE/ID_PAGE?sk=app_".$app_id
));
die ('<script type="text/javascript">top.location.href="' . $loginUrl . '";</script>');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment