ptwobrussell / Mining-the-Social-Web

The official online compendium for Mining the Social Web (O'Reilly, 2011)
http://bit.ly/135dHfs
Other
1.21k stars 491 forks source link

Example 9-1 not working #16

Closed jcprandini closed 11 years ago

jcprandini commented 12 years ago

I've tried my App ID/API Key, my App Secret, and my own Facebook id on the code of example 9-1 in the CLIENT_ID variable.

Every time the python interpreter gets the command

webbrowser.open('https://graph.facebook.com/oauth/authorize?'

I get in the browser the message

{ "error": { "message": "Error validating application.", "type": "OAuthException" } }

Thanks for your attention, jcprandini.

ptwobrussell commented 12 years ago

There's some bad news and good news: Unfortunately this problem may be related to https://github.com/facebook/python-sdk/commit/cb8dbd3fca034aceaea35983037b4a166360c460. The good news is that I'm planning to fork the code and fix it up within the next week as part of a "version 1.1" type update to Mining the Social Web where I also fixup a few other things. Please be patient, and I promise to alert you just as soon as I have it resolved.

jcprandini commented 12 years ago

Many thanks for your prompt answer. I'll be looking forward for your forks and fixings!

ptwobrussell commented 12 years ago

I am in the midst of tracking down what, if anything, has actually broken due to the recent changes with how OAuth 2.0 cookies are handled on Facebook. I am finding that if I set the CLIENT_ID variable to my Facebook app's "App ID/API Key" value that I can then run the facebook__login.py script without error...and then follow up with another script such as

$ python facebook__fql_query.py 'select source_id, target_id from connection where source_id = me()'

and everything works as expected...so I'm not sure that anything has broken after all. It would be helpful to hear back from you on this. I'd like to make sure that you are squared away as well as make sure nothing is broken for anyone else in case my environment/setup is somehow uniquely different (and I'm unaware of how.)

ptwobrussell commented 12 years ago

After further review, it appears that the recent python-sdk deprecation https://github.com/facebook/python-sdk is actually a non-issue since Mining the Social Web uses more of a "desktop app" OAuth login flow as described at http://developers.facebook.com/docs/authentication/, which doesn't involve cookies at all. If anyone feels otherwise, please speak up here or at http://www.facebook.com/MiningTheSocialWeb, and I'll take another look.

However, it would appear that community support for the deprecated python-sdk is now available at https://github.com/pythonforfacebook/facebook-sdk, and I recommend that you use it moving forward. There probably won't be any impacts to MTSW sample code either way from what I saw when reviewing the diff, but the python-sdk is now dead code and the future of the python-sdk fortunately seems to be in good hands.

ptwobrussell commented 11 years ago

Not sure why this issue was re-opened, but feel free to re-open and comment if there's anything else I can do to help.