forked from peteonrails/yaml_twitter_oauth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
42 lines (30 loc) · 1.37 KB
/
README
File metadata and controls
42 lines (30 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
= YAML Twitter OAuth
YAML Twitter OAuth makes it easy to keep track of your Twitter OAuth
consumer tokens and secrets declaratively using YAML. It is designed for
applications that either:
1. Need to maintain multiple Consumer Key/Secret pairs for different environments
2. Need to change the secret from time to time and wwant to do so in YML instead of code
Install with:
script/plugin install git://github.com/peteonrails/yaml_twitter_oauth.git
To use, simply create a <tt>config/twitter_oauth.yml</tt> file that follows the sample
pattern below. (A sample twitter_oauth.yml template file is found in the templates/
directory of this plugin.)
Sample:
defaults: &defaults
request_token_url: http://twitter.com/oauth/request_token
access_token_url: http://twitter.com/oauth/access_token
authorize_url: http://twitter.com/oauth/authorize
development:
<<: *defaults
consumer_key: 12345678
consumer_secret: this-is-your-application-secret
staging:
<<: *defaults
consumer_key: 12345678
consumer_secret: this-is-your-application-secret
production:
<<: *defaults
consumer_key: 12345678
consumer_secret: this-is-your-application-secret
Then in your client code that you use to generate Request and Access Tokens, you can do this:
Twitter::OAuth.new(YamlTwitter.oauth[:consumer_key], YamlTwitter.oauth[:consumer_secret])