I am trying to share items on Facebook by posting them on the wall via my FB app. I setup everything on the client side and the server side as well (ASP.NET MVC3), but I noticed that when the ActionMethod is decorated with the CanvasAuthorize
attribute, the method does not get triggered at all. So is there anything I could do?
P.S: I checked the posted data by the AJAX call and everything seemed fine on that end. Moreover, if I comment the [CanvasAuthorize]
line, the method gets triggered and the params are all fine, except when I get to the fb.Post()
call, it complains that there is no access_token which makes sense.
//[CanvasAuthorize(Permissions = "publish_stream")]
public ActionResult PostItem(string message, string link, string picture, string name)
{
var fb = new FacebookWebClient();
var postArgs = new Dictionary<string, string>();
postArgs["message"] = message;
postArgs["link"] = link;
postArgs["picture"] = picture;
postArgs["name"] = name;
fb.Post("/me/feed", postArgs);
return Json(new {result = "success"}, JsonRequestBehavior.AllowGet);
}
Any ideas?
UPDATE:
Here's a follow-up: Passing the signed_request along with the AJAX call to an ActionMethod decorated with CanvasAuthorize