Facebook JS API: How to get FB.Connect.streamPublish to use auto_publish

Posted by Prody on Stack Overflow See other posts from Stack Overflow or by Prody
Published on 2010-03-12T17:18:47Z Indexed on 2010/03/18 17:21 UTC
Read the original article Hit count: 447

Filed under:
|

I'm trying to publish stuff to someone's wall.

It works, but I'm also trying to use the auto_publish feature so the user will only get one popup granting the publish_stream extended permission.

So I set streamPublish's auto_publish to true, but I still get the popup asking me if I want to publish and/or edit the message.

What am I doing wrong?

Here's what I'm running:

FB.ensureInit(function () {
    FB.Facebook.get_sessionState().waitUntilReady(function() {
        FB.Connect.showPermissionDialog("publish_stream", function(perms) {
            if (perms == "publish_stream") {
                FB.Facebook.apiClient.friends_get(null, function(result) {
                    var markup = "";

                    var targets = result;
                    targets = [testFriendsIDForTesting];

                    var attachment = {
                        name: "Blablabla",
                        href: window.location.href,
                        description: "description",
                        caption: "caption"
                    };

                    var actionLinks = [{
                        text: "View",
                        href: window.location.href
                    }];

                    var num_targets = targets.length;
                    for (var i=0; i<num_targets; i++) {
                        var fId = targets[i];
                        FB.Connect.streamPublish("none", attachment, actionLinks, fId, "none", null, false);
                    }

                });
            }
        });

    });
});

© Stack Overflow or respective owner

Related posts about facebook

Related posts about facebook-connect