开发者

Graph API - Access Token (Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user.)

I'm using Facebook PHP SDK and trying to post image to the user's wall. However I get error below:

"Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in C:\developing...\base_facebook.php on line 1033"

I understand that my access token is not valid, but I can't understand why. I have global facebook object and I'm using $facebook->api function in the subsite of my website (different url, where I have orginally asked access token). My question is that do I need new access tokens for my subsites? Basicly that would mean that I need new app key and secret code as well, because Facebook allows redirect开发者_运维问答ing only for one page spesified in Developer Site.

Below is quite basic api call:

$upload_photo = $this->facebook->api('/me/photos?access_token='. $this->facebook->getAccessToken(), 'post', $photo_details);


I'm not 100% sure, but I think the problem is not domain-related. When you call

$this->facebook->getAccessToken();

this could give you both a user access token and an access token for the facebook application you are using. And to post on a user's wall you will need an access token for a user (or page), on behalf of which you want to publish the wall post.

If the used token is the right one, then another reason could be, that your application doesn't have the needed permissions to post a wall. You will need extended permissions for your app, like the "publish_stream" permission.

Maybe this tutorial can help you further: http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/

It explains how to generate a FB-Login link and require extended permissions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜