twitter_oauth_token

Gimme that Twitter OAuth access token!

Circle CI

This is the library version of the get-twitter-oauth-token command line tool :sweat_smile:

Installation

$ git clone https://github.com/dkhamsing/twitter_oauth_token.git
$ cd twitter_oauth_token/
$ rake install

Usage

$ irb
irb(main):001:0> require 'twitter_oauth_token'
=> true
irb(main):002:0> TwitterOAuthToken::get
[Step 1 of 4] consumer key: ...
[Step 2 of 4] consumer secret: ...
[Step 3 of 4] open this link in a browser (sign in and authorize): https://api.twitter.com/oauth/authorize?oauth_token=jKbOtQAAAAAAt_QtAAABU1NHQWU
[Step 4 of 4] enter pin: 1374423
=> {"access_token"=>"...", "access_token_secret"=>"...", "error"=>nil}

:tada:

Custom Prompts

prompts = {
  TwitterOAuthToken::PROMPT_CONSUMER_KEY => 'Enter Twitter app consumer key: ',
  TwitterOAuthToken::PROMPT_CONSUMER_SECRET => 'Enter Twitter app consumer secret: ',
  TwitterOAuthToken::PROMPT_OPEN_URL => 'Paste this URL in your browser: ',
  TwitterOAuthToken::PROMPT_PIN => 'What\'s the pin? '
}

TwitterOAuthToken::get(prompts)
Enter Twitter app consumer key: ...
# ...

Examples

Credits

Contact

License

This project is available under the MIT license. See the LICENSE file for more info.