I am in control of three twitter accounts: One is my main account, the other two are supposed to automatically post content via a bot. I created the bot logic and added it to Twitter’s development tools and I can easily use it to post to my main account.
Now I need to add the access tokens for my two secondary accounts. My question is – what’s the easiest way to do this.
As far as I can see, Twitter only enables one way to do this: 3-legged OAuth flow. It is not too complex, but it seems to me to require setting up a mock website with callback url, which seems like too much considering I only need to generate two api tokens. Am I missing something?
2
Answers
You’re not missing something. The reason this is required is to force users have a browser they trust open and see that they are on
https://twitter.com/
, so they can trust that it’s a safe place to put in their password.There are some alternative ways to generate access token and access token secret for OAuth 1.0A via command line tools which allow you to use the “PIN-based” OAuth flow.
One example would be Twitter’s own
twurl
tool for API testing, which requires you to also have Ruby installed. This will let you authenticate a user account (it still pops open a window onto twitter.com to have you do the authentication) and stores them into the~/.twurlrc
file in your home directory. There is alsotw-oob-oauth-cli
which is a standalone app for doing the same thing.