https://github.com/dkhamsing/twitter_oauth_token
:hand: Twitter OAuth token Ruby library
https://github.com/dkhamsing/twitter_oauth_token
Last synced: 8 months ago
JSON representation
:hand: Twitter OAuth token Ruby library
- Host: GitHub
- URL: https://github.com/dkhamsing/twitter_oauth_token
- Owner: dkhamsing
- License: mit
- Created: 2016-03-08T00:01:32.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-29T17:01:43.000Z (almost 10 years ago)
- Last Synced: 2025-08-24T17:36:11.347Z (9 months ago)
- Language: Ruby
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# twitter_oauth_token
Gimme that Twitter OAuth access token!
[](https://circleci.com/gh/dkhamsing/twitter_oauth_token) [](https://badge.fury.io/rb/twitter_oauth_token)
This is the library version of the [`get-twitter-oauth-token`](#credits) command line tool :sweat_smile:
## Installation
```shell
$ gem install twitter_oauth_token
```
## Usage
```shell
$ 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
```ruby
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
- [test](https://github.com/dkhamsing/twitter_oauth_token/blob/master/test/authorize_url_test.rb)
- [`update_profile_pic`](https://github.com/dkhamsing/update_profile_pic)
- [`delete_my_tweets`](https://github.com/dkhamsing/delete_my_tweets)
## Credits
- [`get-twitter-oauth-token`](https://github.com/jugyo/get-twitter-oauth-token)
## Contact
- [github.com/dkhamsing](https://github.com/dkhamsing)
- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)
## License
This project is available under the MIT license. See the [LICENSE](LICENSE) file for more info.