views:

41

answers:

1

Can anyone tell me how I could go about authenticating with the various OAuth login mechanisms on the internets (Twitter, Facebook) so that I can run scripts against these services.

As an example, right now when I use Facebook data I goto graph.facebook.com and copy paste the access key from the URL. Obviously this is a bad approach, it has sufficed for now, but is not really an option anymore :)

I've checked out the documentation on the facebook site in particular which requests that I use a callback urL and so on. I'd like to be able to make a call from a ruby script which requests the OAuth token instead.

Is this even possible?

P.s This would be using my own credentials.

+1  A: 

Yes, it is possible. http://developers.facebook.com/docs/authentication/ "Authenticating as an Application" section.

zerkms
From the site "Facebook's OAuth implementation does not include explicit desktop application support." It basically asks for you to stick a web browser into your application and go thorugh the entire standard web based process. I just want to put something into my script that will get a new access key when needed.
steve
@steve: not for all tasks browser is needed. try to explain more detailed what exactly you will do from your **desktop** application.
zerkms
I want to gather my posts by running a ruby script so https://graph.facebook.com/me/home?access_token=ACCESS TOKEN HEREand ideally anything else on my profile I deem relevant (Usually my groups)
steve
browser is not necessary then. you need just give permission to your application to read your wall (read about extended permissions). that's it. after that you can read from your application your wall (but you will have to use your "nickname" or "user_id" instead of "me", since you will not be logged in)
zerkms
Can you point me where this is explained? The documentation on the facebook site seems to mention passing back to redirect pages etc. etc.
steve
graph documentation has nothing about pages. you can do request with any interface you like. as you see - in the official documentation examples has been done with cURL.
zerkms
yes, if I have a correct key, getting the key is where all this falls apart. Right? So if I pass it a valid Oauth key everything is fine and dandy. The key will expire eventually, I don't want to manually enter a key in future.
steve
yes, facebook oauth token is short term live, so right before new working session you should retrieve new one.
zerkms
My question is about authenticating with a script that does not use a web based authentication. I want a new key to be gathered by my script
steve
I don't know facebook oauth in details, but it is definitely possible, because in one of my applications i read my wall and post to some pages without any active user being authenticated. and i did that with official php sdk.
zerkms
Can you give more information please. From what I can see its not possible. Thanks
steve
From documentation ;-) Facebook oauth it well documented and simple enough
zerkms
No it's not. From what I can see the documentation says that this is not possible by using their standard approach. I am not seeing any way to verify with their OAuth through a script that gives me the same access as if I'm using my own OAuth key when visiting the website.
steve