omniauth_dailycred 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +88 -17
- data/lib/omniauth_dailycred.rb +1 -4
- data/lib/omniauth_dailycred/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b47a27e0054f179b403fbee7447c982b704a06e
|
4
|
+
data.tar.gz: 05caa3c58caf5d76037e89808d48ec0da36b45ac
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fca6b792956cf751f530a2bcb8ae097e21adf56078d0d4f7114bb667166b94153d2d7f9c9d58d849feb5647144db5a0cc5e919527223f5a7544a41088eb850f4
|
7
|
+
data.tar.gz: 1d168af544c63db3a784d251a49f64868b57d4dbe71a7709805a64e149f2d04d79fea1a83c2ec582833c585c1b2f2841f60f830808209a147aeac2935caa3207
|
data/README.md
CHANGED
@@ -1,29 +1,100 @@
|
|
1
|
-
#
|
1
|
+
# Omniauth_Dailycred
|
2
2
|
|
3
|
-
|
3
|
+
This gem is intended for users who solely want to interact with [dailycred](https://www.dailycred.com) through omniauth. If you are looking into a more comprehensive authentication solution with dailycred, you should see our [rails engine](https://github.com/dailycred/dailycred).
|
4
4
|
|
5
|
-
|
5
|
+
Because we've extracted OAuth login from the [Rails engine](https://github.com/dailycred/dailycred) into its own [omniauth gem](https://github.com/dailycred/omniauth_dailycred), it's now extremely easy to implement dailycred in an existing project.
|
6
6
|
|
7
|
-
|
7
|
+
## Why?
|
8
8
|
|
9
|
-
|
9
|
+
Even if you've already set up authentication, Dailycred can be extremely helpful as a proxy for other authentication providers. For example:
|
10
10
|
|
11
|
-
|
11
|
+
* Not all OAuth providers allow you to pass state, and none of them allow you to pass additional parameters like ['referrer'](https://www.dailycred.com/api/server-side).
|
12
|
+
* You get instant access to a [comprehensive dashboard](https://www.dailycred.com/demo) to view your users and get a deeper insight into their behavior.
|
13
|
+
* Only implement one omniauth provider, and then send your user to any [identity provider](https://www.dailycred.com/api/providers) by sending them to the following route:
|
12
14
|
|
13
|
-
|
15
|
+
/auth/dailycred?identity_provider=[provider]
|
16
|
+
|
14
17
|
|
15
|
-
Or install it yourself as:
|
16
18
|
|
17
|
-
|
19
|
+
##Installation
|
18
20
|
|
19
|
-
|
21
|
+
In your gemfile
|
20
22
|
|
21
|
-
|
23
|
+
~~~
|
24
|
+
gem 'omniauth_dailycred'
|
25
|
+
~~~
|
22
26
|
|
23
|
-
|
27
|
+
Then run `bundle`.
|
28
|
+
|
29
|
+
##Usage
|
30
|
+
|
31
|
+
Create an initializer at `config/initializers/omniauth.rb` with the following:
|
32
|
+
|
33
|
+
~~~
|
34
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
35
|
+
provider :dailycred, ENV['DAILYCRED_CLIENT_ID'], ENV['DAILYCRED_SECRET']
|
36
|
+
end
|
37
|
+
~~~
|
38
|
+
|
39
|
+
Then simply send your users to `auth/dailycred` and they will be forwarded through the OAuth flow. The following parameters can be passed along to dailycred:
|
40
|
+
|
41
|
+
1. action
|
42
|
+
1. identity_provider
|
43
|
+
1. referrer
|
44
|
+
1. access_token
|
45
|
+
|
46
|
+
If you run into an SSL Error, it's because omniauth can't find your ssl certicate. Try modifying `config/initializers/omniauth.rb` to look like the following:
|
47
|
+
|
48
|
+
~~~
|
49
|
+
opts = {:client_options => {:ssl => {}}}
|
50
|
+
|
51
|
+
if File.exists?('/etc/ssl/certs')
|
52
|
+
opts[:client_options][:ssl][:ca_path] = '/etc/ssl/certs'
|
53
|
+
end
|
54
|
+
if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt')
|
55
|
+
opts[:client_options][:ssl][:ca_file] = '/opt/local/share/curl/curl-ca-bundle.crt'
|
56
|
+
end
|
57
|
+
|
58
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
59
|
+
provider :dailycred, ENV['DAILYCRED_CLIENT_ID'], ENV['DAILYCRED_SECRET'], opts
|
60
|
+
end
|
61
|
+
~~~
|
62
|
+
|
63
|
+
Follow the omniauth instructions to [integrate omniauth into your application](https://github.com/intridea/omniauth#integrating-omniauth-into-your-application) for further setup details.
|
64
|
+
|
65
|
+
In your *callback*, `request.env['omniauth.auth']` will look something like the following:
|
66
|
+
|
67
|
+
~~~
|
68
|
+
{
|
69
|
+
"provider" => "dailycred",
|
70
|
+
"uid" => "userid-xx-yy",
|
71
|
+
"info" => {
|
72
|
+
"token" => "token-xxyy-token",
|
73
|
+
"provider" => "dailycred",
|
74
|
+
"uid" => "userid-xx-yy",
|
75
|
+
"ban" => false,
|
76
|
+
"user_type" => "CONVERTED",
|
77
|
+
"identities" => {},
|
78
|
+
"display" => "test@test.com",
|
79
|
+
"emails" => {},
|
80
|
+
"picture" => "https://www.dailycred.com/user/pic?user_id=userid-xx-yy&size=50",
|
81
|
+
"updated_at" => 1366670682849,
|
82
|
+
"created" => Mon, 15 Apr 2013 18:20:28 +0000,
|
83
|
+
"email" => "test@test.com",
|
84
|
+
"last_logged_in" => 1366670682848,
|
85
|
+
"verified" => false,
|
86
|
+
"guest" => false,
|
87
|
+
"attributes" => {},
|
88
|
+
"access_tokens" => {
|
89
|
+
"dailycred" => "token-xxyy-token"
|
90
|
+
},
|
91
|
+
"access_token" => "token-xxyy-token"
|
92
|
+
},
|
93
|
+
"credentials" => {
|
94
|
+
"token" => "token-xxyy-token",
|
95
|
+
"expires" => false
|
96
|
+
},
|
97
|
+
"extra" => {}
|
98
|
+
}
|
99
|
+
~~~
|
24
100
|
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
data/lib/omniauth_dailycred.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth_dailycred
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hank Stoever
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.0.
|
105
|
+
rubygems_version: 2.0.3
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Use if you only want to communicate with Dailycred through omniauth.
|