开发者

Posting links to facebook page without user authentication

Basically I have a web app that will be posting links to a facebook page(not profile) wall.

As far as I know I need开发者_C百科 a permanent token to do this. Twitter gives me one straight off the account, so I was hoping facebook would have something similar. However the token I get with the manage_pages permission has an expiry.

From the authentication docs this is what I've been doing:

request token to manage pages:

https://www.facebook.com/dialog/oauth?client_id=123456789123&redirect_uri=http://myapp.com/fb&scope=manage_pages&response_type=token

get token back the url which I intend paste it into my apps config:

http://myapp.com/fb#access_token=123123123123123%7C2.18VYbalblablablaswhg__.3600.1304294400.1-615173155%7CTzb_U9ma0LIPJXNzqsZ_xUJpfn8&expires_in=4205

When I actually try to post to the page with this, I get an expired error.

$post_params = array(
'access_token' => self::$page_token,
'message' => $string
);
$response = $fb_app->api('/'.self::$page_id.'/feed','POST', $post_params);


You need the offline_access permission to get a permanent token. If you intend to post as the page itself, you need to get the token from /USER_ID/accounts for that page, else you will post from your profile. If you don't intend to post as the page, you actually don't need the manage_pages permission, publish_stream for the user is enough. Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜