Pylons and Facebook

Posted by Nayan Jain on Stack Overflow See other posts from Stack Overflow or by Nayan Jain
Published on 2011-03-20T18:37:09Z Indexed on 2011/03/20 19:21 UTC
Read the original article Hit count: 272

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about python

Related posts about facebook