I'm using the runwithfriends example app to learn canvas programming and GAE. I can upload the sample code to GAE without any errors. Here are my config.py and app.yaml files:
conf.py:
# Facebook Application ID and Secret.
FACEBOOK_APP_ID = ''
FACEBOOK_APP_SECRET = ''
# Canvas Page name.
FACEBOOK_CANVAS_NAME = 'blah'
# A random token for use with the Real-time API.
FACEBOOK_REALTIME_VERIFY_TOKEN = 'RANDOM TOKEN'
# The external URL this application is available at where the Real-time API will
# send it's pings.
EXTERNAL_HREF = 'http://blah.appspot.com'
# Facebook User IDs of admins. The poor mans admin system.
ADMIN_USER_IDS = ['']
app.yaml
application: blah
version: 1
runtime: python
api_version: 1
handlers:
- url: /(.*\.(html|css|js|gif|jpg|png|ico))
static_files: static/\1
upload: static/.*
expiration: "1d"
- url: .*
script: main.py
- url: /task/.*
script: main.py
login: admin
Accessing the demo app on their GAE works just fine. When I take the exact same code, except for the changes I need to run under my own GAE account, the app won't work. I can login to the app using my account and the app shows up under my Apps menu. So, OAuth is good. Every time I go to access the main page, I'm always redirected to the iframe showing I use the app (can't show that image, runwithfriends app is over quota as I type this) but won't go to this iframe:
at all.
I've looked at and understand how url routing works:
def main():
routes = [
(r'/', RecentRunsHandler),
(r'/user/(.*)', UserRunsHandler),
(r'/run', RunHandler),
(r'/realtime', RealtimeHandler),
(r'/task/refresh-user/(.*)', RefreshUserHandler),
]
application = webapp.WSGIApplication(routes,
debug=os.environ.get('SERVER_SOFTWARE', '').startswith('Dev'))
util.run_wsgi_app(application)
All the handlers are there with what looks like correct post/get methods. There are no errors logged in my GAE instance either, such as 404 or 405. When I first use http://localhost:8080
, I see plenty of 200s and nothing else.
I started out using dev_appengine.py but had to move development to GAE because of my HTTPS security setting. I disabled HTTPS temporarily but still always get redirected to the apps.facebook.com/path no matter what and can't keep all my development within dev_appengine.py. Don't know if that's related to my issue or not.
Since the demo works (when not over quota), I'm sure the problem is with my own GAE instance, or configuration within FB to use my GAE, I just for the life of me can't figure out. I'm using Eclipse with PyDev and GAE plugins.
Update
Adding the app's FB configuration and the window that's displayed after I login to the app.
Sandbox:
Redirects:
Running under my GAE, this is the only page that is returned:
Can you post what your error actually looks like?
It sounds like you don't have the FB redirection set up properly. Or potentially your FB is set up in a sandbox and you're trying to access your app with a non-sandboxed user.
I decided to delete my test FB app and recreate it. When I went to enter my key/secret values was when I found my error. My issue was with my FB APP ID and SECRET - both had a space between the single quotes like this:
Having the space was screwing things up, once I went to enter the new values in conf.py I spotted the extra spaces. The correct constant declaration:
Test FB App works now.