views:

213

answers:

1

I'm trying to fetch the logged in user's ID with Facebook + PyFacebook via:

#Establish connection to Facebook via API
f = Facebook(config['app_conf']['pyfacebook.apikey'],
             config['app_conf']['pyfacebook.secret'])

#Get the current Facebook ID
facebook_id = f.users.getLoggedInUser()

But I keep getting the error:

FacebookError: Error 453: A session key is required for calling this method

What am I doing wrong? Thanks.

A: 

A look at the source shows an example app, and in there it calls f.auth.createToken() followed by f.login() before doing anything else. If you're not logged in, you won't get a session key.

Kylotan
f.login() is for desktop applications though, not for web apps. It tries to open lynx.
ensnare
It seems a bit strange that it would do that. Maybe there's something else for logging-in purposes then. How about f.auth.getSession()?
Kylotan