(#3)应用程序必须在白名单facebook上

时间:2011-09-15 20:26:52

标签: javascript facebook facebook-graph-api whitelist

我正在尝试使用FB.api将一个消息发布到墙上

我的权限是:'email,read_stream,publish_stream',我的代码是:

FB.getLoginStatus(function(response){
    if(response.session) {
        var accessToken = response.session.access_token;
        var tokenUrl = "https://graph.facebook.com/me/feed?access_token=" + accessToken + "&callback=?";

        var shareUserId = document.getElementById("shareHidden").value;
        var shareTxtAreaMsg = document.getElementById("shareTxtArea").value;
        console.log("friends user Id: " + shareUserId + " & " + "message: " + shareTxtAreaMsg);

        var data = {
            message: "shareTxtAreaMsg",
            display: 'iframe',
            caption: "Caption",
            name: "Name",  
            picture: 'http://someDomain.com/Dev/img/share-force-wall-img.jpg',    
            link: "http://www.facebook.com/pages/someapp/XXXXXXXXXXX?sk=app_XXXXXXXXXXXXXX",  // Go here if user click the picture
            description: "Description field",
            actions: [{ name: 'action_links text!', link: 'some link' }],           
        }

        console.log(accessToken);

        FB.api(tokenUrl, 'post', data, function(response){
            if (response)
            {
                //console.log(response);
                if (response.error)
                {
                    console.log(response.error.message);
                }
                else
                {
                    if (response.id)
                        console.log("Posted as post_id "+response.id);                      
                    else if (response.post_id)
                        console.log("Posted as post_id "+response.post_id);
                    else
                        console.log("Unknown Error");
                }
            }
        });
    }
});

当尝试发布消息时,我得到“(#3)应用程序必须在白名单上”返回。为什么会这样?

1 个答案:

答案 0 :(得分:0)

尝试FB.api('/ me / feed'...而不是tokenUrl,因为FB.api会自动添加完整的网址前缀。