开发者

How to get publish_stream permissions for facebook app?

I have an app which has been running for a while which has only requested some account information for login purposes. Now I want to use it to publish to the stream. I have added publish_stream to the req_perms but, it still doesn't ask for that permission.

Am I missing something?

<?php
# CREATE FACEBOOK BUTTON
    $facebook = new Facebook(array(
        'appId'  => FACEBOOKAPPID,
        'secret' => FACEBOOKSECRET,
        'cookie' => false,
    ));
    $fb_session = $facebook->getUser();
    $fb_me = null;
    // Session based API call.
    if ($fb_session) {
        try {
            $fb_uid = $fb_session;
            $fb_me = $facebook->api('/me');
            $fb_me['photo'] = 'http://graph.facebook.com/'.$fb_uid.'/picture?type=large';
            $_SESSION['login_api'] = 1;
            $_SESSION['login_api_details'] = $fb_me;
            $_SESSION['login_api_user_id'] = $fb_uid;

            # WE ARE GOOD TO GO, LETS GET THE ACCESS TOKEN
            $_SESSION['access_token'] = $facebook->getAccessToken();


            #header_redirect(SITEURL.'/login');         

        } catch (FacebookApiException $e) {
            error_log($e);
        }
    }
    else{
        # LOGIN URL FOR FACE BOOK & request extra stuff
        $fb_l开发者_JS百科ogin_url = $facebook->getLoginUrl(array('req_perms'=>'publish_stream,email,user_about_me,user_birthday,user_website'));
        header_redirect($fb_login_url);
    }
?>


Try this in your else

$params = array(
    'canvas' => 1,
    'scope'  => 'publish_stream,email,user_about_me,user_birthday,user_website',
    'fbconnect' => 1,
    'redirect_uri' => 'https://apps.facebook.com/YOURAPP',
);


$fb_login_url = $facebook->getLoginUrl($params);
header_redirect($fb_login_url);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜