Share custom story with staged image on Facebook using FB.ui no working -
i have next code stage canvas image , create object share using fb.ui. staging image , create object working without problem share dialog not displayed. if replaced image parameter in create object image url working.
is there wrong in code:
var useraccesstoken = $("#user_access_token").val(); var appaccesstoken = $("#app_access_token").val(); seek { blob = datauritoblob(dataurl); } grab (e) { console.log(e); } var fd = new formdata(); fd.append("access_token", useraccesstoken); fd.append("file", blob); seek { var imageuri; $.ajax({ url: "https://graph.facebook.com/me/staging_resources", type: "post", data: fd, processdata: false, contenttype: false, cache: false, success: function (data) { console.log("success " + data['uri']); imageuri = data['uri']; }, error: function (shr, status, data) { console.log("error " + info + " status " + shr.status); }, complete: function () { fb.api( 'https://graph.facebook.com/app/objects/myappnamespace:myobject', 'post', { access_token : appaccesstoken, object:{ app_id: myappid, url: "myappurl", title: "sample photo", image: { url:imageuri, user_generated:true }, description: "" } }, function(response) { var objectid = response['id']; fb.ui({ method: 'share_open_graph', action_type: 'myappnamespace:myaction', action_properties: json.stringify({ myobject:objectid }) }, function(response){}); } ); } }); } grab (e) { console.log(e); }
finally found solution changing user_generated parameter true false
now code creating object looks below:
fb.api( 'https://graph.facebook.com/app/objects/myappnamespace:myobject', 'post', { access_token : appaccesstoken, object:{ app_id: myappid, url: "myappurl", title: "sample photo", image: { url:imageuri, user_generated:false }, description: "" } } facebook facebook-graph-api
No comments:
Post a Comment