Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bypass Twitter OAuth

Essentially the same problem as this question but looking for a solution in Python. How to work around Twitter OAuth?

Ideally, I dont want to have to go through the hoops of setting up a user/login interface and backend since the work I'm doing is for internal purposes.

I would also like to bypass the part where I need to re-direct the user to Twitter for authorization.

Thanks

like image 501
super9 Avatar asked May 06 '11 02:05

super9


3 Answers

You'll want to use Twitter's OOB flow. This is explained nicely in this answer

Twitter API - OOB Flow

like image 155
JohnD Avatar answered Oct 01 '22 04:10

JohnD


So, reading between the lines a little, you have a twitter account and a password because this is internal, so you don't want to go with an auth process that requires a user to interact with it?

The idea behind OAuth is that you don't ever find out what the user's password is; I agree that if I'm right about what you are trying to do that it isn't the right thing. The OOB Flow suggested by JohnD has the same problem.

If you do have an account/password, then you can work with submissions to the website directly, using the login form and the tweet form. Unfortunately this means you don't have access to the API (they nuked basic authentication via the API last year) -- depending on what you're trying to do that may or may not be a problem.

Edit:

Use OAuth and remember the token. It never expires, according to the twitter API docs, and since you presumably have some limited number of accounts that you care about, you can just jump through the OAuth hoops once for each account and you're done until you need another account. You can even do the whole thing programmatically given the username and password, assuming they don't stick a captcha in there at some point. But I suspect your best bet is to just use OAuth and store the tokens.

like image 32
Dave Orr Avatar answered Oct 01 '22 06:10

Dave Orr


I just found this bash script that works, tested personally, just change --ssl to --sslv3.

It's based on a simpler auth method used on mobile.twitter.com, you can use the same principle to deal with it using urllib2 and re modules.


Otherwise you can consider to lean against a site like http://www.supertweet.net/

SuperTweet.net provides a safe mechanism to use Basic Authentication with the Twitter API in your scripts and other Twitter apps. Simply Sign-up via Twitter to authorize the MyAuth API Proxy SuperTweet.net Application and then assign a password of your choosing (not your real Twitter password) that your applications can use with the http://api.supertweet.net API.

edit: I see now this site was cited in an article linked in an answer of How to work around Twitter OAuth?, if you already read about it ignore this part.

like image 27
neurino Avatar answered Oct 01 '22 05:10

neurino