Facebook JS API: How to get FB.Connect.streamPublish to use auto_publish
- by Prody
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);
}
});
}
});
});
});