oauthorizer 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +45 -2
- data/lib/oauthorizer/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Oauthorizer
|
2
2
|
|
3
|
-
|
3
|
+
A gem to automatically go out and grab new access tokens when making oauth calls. Then storing them in a yml file for later use and reference.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,10 +16,53 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install oauthorizer
|
18
18
|
|
19
|
+
## Setup
|
20
|
+
|
21
|
+
Create a file in config/initializers/oauthorizer.rb
|
22
|
+
|
23
|
+
oauthorizer_keys = YAML.load_file(File.join(Rails.root, 'config', 'oauthorizer_config.yml'))
|
24
|
+
|
25
|
+
Rails.application.config.middleware.insert_before ActionDispatch::Static, Rack::Oauthorizer, oauthorizer_keys
|
26
|
+
|
27
|
+
Create a config file in your config directory.
|
28
|
+
|
29
|
+
google:
|
30
|
+
client_id:
|
31
|
+
client_secret:
|
32
|
+
scope: https://www.googleapis.com/auth/latitude.all.best+https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/userinfo.email
|
33
|
+
redirect_uri: http://localhost:3030/callbacks/google.json
|
34
|
+
server_port: 3030
|
35
|
+
user_email:
|
36
|
+
user_password:
|
37
|
+
facebook:
|
38
|
+
client_id:
|
39
|
+
client_secret:
|
40
|
+
scope: publish_checkins
|
41
|
+
redirect_uri: http://localhost:3030/callbacks/facebook.json
|
42
|
+
server_port: 3030
|
43
|
+
state: stuff
|
44
|
+
user_email:
|
45
|
+
user_password:
|
46
|
+
foursquare:
|
47
|
+
client_id:
|
48
|
+
client_secret:
|
49
|
+
redirect_uri: http://localhost:3030/callbacks/foursquare.json
|
50
|
+
server_port: 3030
|
51
|
+
user_email:
|
52
|
+
user_password:
|
53
|
+
|
54
|
+
Make sure that the port in your redirect_uri matches your server_port.
|
55
|
+
|
56
|
+
You must fill in information for the client_id, client_secret, user_email and password. The user email and password should be for a test account that you have setup.
|
57
|
+
|
19
58
|
## Usage
|
20
59
|
|
21
|
-
|
60
|
+
In your spec simply initialize Oauthorizer then set a variable for the token.
|
22
61
|
|
62
|
+
oauther = Oauthorizer::Token.new
|
63
|
+
token = oauther.get_google_token_hash
|
64
|
+
token = oauther.get_facebook_token_hash
|
65
|
+
token = oauther.get_foursquare_token_hash
|
23
66
|
## Contributing
|
24
67
|
|
25
68
|
1. Fork it
|
data/lib/oauthorizer/version.rb
CHANGED