ensnare
ensnare

Reputation: 42093

Fetch Facebook ID with PyFacebook, "Session key is required"

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.

Upvotes: 1

Views: 1205

Answers (1)

Kylotan
Kylotan

Reputation: 18449

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.

Upvotes: 0

Related Questions