开发者

(#3) App must be on whitelist facebook

开发者 https://www.devze.com 2023-04-05 17:52 出处:网络
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:

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?


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

0

精彩评论

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