I have some problems getting canvas url to display for my facebook application that is hosted on google app engine, I’m working with python.
On google app engine (www.my-app.appspot.com) everything works great, but when I try to see my app on facebook the canvas is totally blank.
URL canvas: http://my-app.appspot.com/
Secure URL canvas: https://my-app.appspot.com/
Is there something wrong with my configurations?
Thanks
Your configurations are correct.
If you are using the https://github.com/pythonforfacebook/facebook-sdk
You will need to make some changes to the example code.
The example.py file defines “get” and “post” methods under the HomeHandler class.
The “get” will not work when the page is running as a Canvas App inside Facebook.com, though it will work when the page is directly called by a browser.
Facebook loads the Canvas App into its iframe using a POST request containing the signed_request argument as detailed here:
https://developers.facebook.com/docs/howtos/login/signed-request/
The first step you can take to fix the example.py file is as follows.
This will at least get code showing up inside Facebook:
Comment out the original “post” method:
Duplicate the “get” method as the “post” method, now both get and post are:
Once that is done, you can test within Facebook. “example.html” should display in the iframe, however, by default, “example.html” asks for an image URL to upload. That will no longer work since the original “post” method is commented out.
To fix the functionality, you’ll need to create if/then statements in the def post(self): method to handle requests. For instance, you may want to re-integrate the original “post” method by checking for the ‘url’ argument – using self.request.get(‘url’) – if it is there, then you know you are receiving an image URL and should branch to the original “post” code