Losing form data when posting to Facebook Canvas iframe app

Here is a brief set of bullet points on what I'm trying to accomplish:

  • Use Facebook C # SDK with asp.net MVC
  • Post custom form data from iframe application on Facebook canvas to server
  • I am currently building from the provided MVC sample

The problem I'm having is that when I submit the form in a canvas iframe application, the only data I get from Facebook is the signed_request form parameter. I need data from the form.

I looked at various solutions to the problem ( see this link ), but I cannot get them to work. When I access the FacebookSession object, the session key is not returned, so I cannot follow the link instructions.

Any advice that could be provided on how to do this would be greatly appreciated.

+3
source share
3 answers

ow3n is correct , what you need to include signed_requestin your data for publication. Which for a C # Facebook application (assuming Razor sorts) means adding this to your form:

<input type="hidden" value="@Request.Params["signed_request"]" name="signed_request" />
+1
source

I ran into the same problem and did this:

<form method="post" id="form1" target="_top">
<input type="text" id="sometext" />
<input type="submit" id="button" />
</form>

<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#button").click(function () {
var action = '<%= Url.CanvasAction("Create", "Home") %>';
action += "?sometext=" + escape($("#sometext"));
$("#form1").attr("action", action);
});
}
</script>

The disadvantage of this is that you send data with a limit for IE of about 2048 characters before chopping off the material, and the worst thing is to open and open to users of this machine, especially if it is in a public cafe bar or something else , and they can see the last person sent to your application!

, Facebook , , → !

0

I had the same problem when I sent POST or GET data using a canvas application and found the answer to this post . Just add this input to your form:

<input type="hidden" value="<?php echo $_POST["signed_request"]?>" name="signed_request" />
0
source

Source: https://habr.com/ru/post/1785271/


All Articles