Pylons and Facebook
- by Nayan Jain
The following is my oauth template
top.location.href='https://graph.facebook.com/oauth/authorize?client_id=${config['facebook.appid']}&redirect_uri=${config['facebook.callbackurl']}&display=page&scope=publish_stream';
Click here to authorize this application
When I hit the page I am prompted to login (desired), upon login I am redirected in a loop between a permissions page and an app page.
My controller looks like:
class RootController(BaseController):
def __before__(self):
tmpl_context.user = None
if request.params.has_key('session'):
access_token = simplejson.loads(request.params['session'])['access_token']
graph = facebook.GraphAPI(access_token)
tmpl_context.user = graph.get_object("me")
def index(self):
if not tmpl_context.user:
return render('/oauth_redirect.mako')
return render('/index.mako')
I'm guessing my settings are off somewhere, probably with the callback.
Not to sure if it is an issue with my code or the python sdk for facebook.