First time working with OAuth want to do some automated stuff

1 view
Skip to first unread message

Hintswen

unread,
Sep 28, 2009, 7:50:31 PM9/28/09
to Twitter Development Talk
I currently have a script running on my server using basic
authentication and tweeting rss feeds to a number of different
accounts.

I want to do something similar to that but using OAuth (seeing as I
cant register an application for basic auth anymore). But I'm lost,
OAuth requires a browser to work doesn't it? but my script wont be run
from a browser.

Do I have to make an authorize page and load that in a web browser to
get the access tokens and then put them into my script? Will they ever
expire? Is there a way to automatically get the access tokens without
me making a web page that will ask me to login to twitter and
authenticate?

Abraham Williams

unread,
Sep 29, 2009, 2:25:36 AM9/29/09
to twitter-deve...@googlegroups.com
On Mon, Sep 28, 2009 at 18:50, Hintswen <hint...@gmail.com> wrote:

I currently have a script running on my server using basic
authentication and tweeting rss feeds to a number of different
accounts.

I want to do something similar to that but using OAuth (seeing as I
cant register an application for basic auth anymore). But I'm lost,
OAuth requires a browser to work doesn't it? but my script wont be run
from a browser.

I'm not sure if you are using PHP but here is a blog post about running server scripts with OAuth: http://kovshenin.com/archives/automatic-tweet-oauth/
 
Do I have to make an authorize page and load that in a web browser to
get the access tokens and then put them into my script?

Yes.
 
Will they ever expire?

No.
 
Is there a way to automatically get the access tokens without
me making a web page that will ask me to login to twitter and
authenticate?

You could write an HTML parser to parse the authorization page but that would be a lot of work and error prone. 

Abraham

--
Abraham Williams | Community Evangelist | http://web608.org
Hacker | http://abrah.am | http://twitter.com/abraham
Project | http://fireeagle.labs.poseurtech.com
This email is: [ ] blogable [x] ask first [ ] private.
Sent from Madison, WI, United States

Jim Renkel

unread,
Sep 29, 2009, 2:34:37 AM9/29/09
to twitter-deve...@googlegroups.com

In answer to your question “Is there a way to automatically get the access tokens without


me making a web page that will ask me to login to twitter and

authenticate?”, I requested this as an enhancement. Here’s the URL to the request:

 

http://code.google.com/p/twitter-api/issues/detail?id=1011

 

Al3x replied that they are working on something to help us out here, but no ETA promised.

 

You may want to visit the issue and star it to give it a little more weight.

 

Thanks,

 

Jim Renkel

 

Josh Roesslein

unread,
Sep 29, 2009, 2:34:51 AM9/29/09
to twitter-deve...@googlegroups.com
If you are new to OAuth check out http://oauth.net first. There is important
details you need to know in the spec before you get started. The site
also provides
links to libraries for about every major language out there. Not sure
if you rolled your
own twitter library or what language you using.

To get the access token you just need to fetch an request token,
authorize it, and then exchange
it for an access token. There is not a way to automate the
authorization step. You can check out this
python script [1] which queries for your consumer key/secret then
opens the authorization link in the browser.
At the end you get your access token. Note: it depends on this [2] library.

Where you go next depends on which library / language you go with.

Best of luck,

Josh

[1] http://www.pastie.org/634526
[2] http://github.com/joshthecoder/tweepy

Reply all
Reply to author
Forward
0 new messages