1

How do you post to Facebook using the Facebook Python SDK? I tried to do it using:

self.Facebook = facebooksdk.GraphAPI(oauth_token)
self.Facebook.put_object("me", "feed", message="Hello World.")

And here's my traceback:

Traceback (most recent call last):
File "epistle.py", line 559, in send
self.Facebook.put_object("me", "feed", message="Hello World.")
File "/home/logan/epistle/facebooksdk.py", line 124, in put_object
return self.request(parent_object + "/" + connection_name, post_args=data)
File "/home/logan/epistle/facebooksdk.py", line 177, in request
response["error"]["message"])

facebooksdk.GraphAPIError: Bad signature

Can anyone help me figure this out?

loganfynne
  • 97
  • 1
  • 1
  • 11

1 Answers1

1

Are you correctly obtaining the oauth_token value? Bad signature indicates the the SDK signed the request to Facebook but the token didn't match what Facebook's API servers were expecting. I would check that you are using the correct Facebook application key and secret when you extract the oauth_token from the Facebook cookie (if you're using the Javascript SDK to log into Facebook) or that your OAuth handshake was properly performed.

Femi
  • 64,273
  • 8
  • 118
  • 148
  • Is there any way to parse the OAuth token from the redirect URL? – loganfynne May 08 '11 at 14:47
  • Yep: you'll get a code (the redirect will look something like this: http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER). You need to pull that parameter, then call back to get the token (like this: https://graph.facebook.com/oauth/access_token? client_id=YOUR_APP_ID&redirect_uri=YOUR_URL& client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE) and that will give you the oauth token you want. I'm honestly not saying anything that's not gone over in great detail at http://developers.facebook.com/docs/authentication/ – Femi May 08 '11 at 15:06