0

I want to include the FB Page wall into the website. For that purpose I need the access token, but on the FB I'm one of the admins not the owner.

When I request an access token I get one of my profile not the profile that I´m administrating. Can I get a token for that wall as admin and not owner ?

4

3 回答 3

0

如果您查看http://developers.facebook.com/docs/authentication/,您会看到有一些选项可以作为应用程序或页面登录:这些选项应该会给您一个访问令牌,可以满足您的需求。

于 2011-08-24T20:01:12.640 回答
0

来自:http: //developers.facebook.com/docs/reference/api/permissions/

"页面access_token

用于管理页面的 access_token。当您要执行作为 Page 的操作时使用此选项。通过向 /USER_ID/accounts 或 /PAGE_ID?fields=access_token 发出 HTTP GET 并具有manage_pages权限来检索此访问令牌。获取 /USER_ID/accounts 将返回用户拥有管理权限的页面列表(包括应用配置文件页面)以及每个页面的 access_token。注意:2011 年 9 月 22 日之后,通过此连接对用户页面的所有访问都需要 manage_pages 权限,即读取用户页面和检索这些页面的 access_tokens。有关更多信息,请参阅用户对象的文档。”

于 2011-08-24T20:03:16.553 回答
0

Facebook扩展了他们的page对象,以便更容易检索“页面”`access_token",您需要的是:

  • manage_pages & read_stream权限
  • page_id
  • 类似于我文章中的代码:

PS:我正在使用 PHP-SDK

<?php
// This code is just a snippet of the example.php script
// from the PHP-SDK <http://github.com/facebook/php-sdk/blob/master/examples/example.php>
require '../src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => 'app_id',
  'secret' => 'app_secret',
));

// Get User ID
$user = $facebook->getUser();

if ($user) {
  try {
    $page_id = 'page_id';
    $page_info = $facebook->api("/$page_id?fields=access_token");
    if( !empty($page_info['access_token']) ) {
        $args = array(
            'access_token'  => $page_info['access_token']
        );
        $page_posts = $facebook->api("/$page_id/posts","get",$args);
    }
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

// Login or logout url will be needed depending on current user state.
if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl(array('scope'=>'manage_pages,read_stream'));
}
?>
于 2011-08-24T20:36:53.000 回答