In a nutshell, what I added to my pages was:
in the <head>:
<script src="http://x.myspacecdn.com/OpenSocial/references/gadgets003.js" type="text/javascript"></script>
<script src="http://x.myspacecdn.com/modules/common/static/js/Apps/ifpc003.js" type="text/javascript"></script>
<script src="http://x.myspacecdn.com/modules/common/static/js/Apps/json001.js" type="text/javascript"></script>
<script src="http://x.myspacecdn.com/OpenSocial/IFPC_externalIframe004.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
MyOpenSpace.MySpaceContainer.get().registerParam("panelId", "apppanel_{APP_ID}_canvas");
MyOpenSpace.MySpaceContainer.get().registerParam("localRelay", "http://{MY_DOMAIN}/ifpc_relay_external001.html");
// ]]-->
</script>
and at the bottom of the pages:
MyOpenSpace.MySpaceContainer.get().adjustHeight();
It has been working fine for me. I'm not sure if all these are necessary, as I also use postTo in my code.