(#3) App must be on whitelist facebook

纵饮孤独 提交于 2019-12-11 00:22:23

问题


I'm trying to post a messsage to a wall using FB.api

My perms are: 'email, read_stream, publish_stream' and my code is:

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");
                }
            }
        });
    }
});

When when try to post the message I'm getting a "(#3) App must be on whitelist" returned. Why is this happening?


回答1:


Try FB.api('/me/feed'... instead of tokenUrl because FB.api will automatically add the full url prefix.



来源:https://stackoverflow.com/questions/7437051/3-app-must-be-on-whitelist-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!