omniauth-multiple_providers 0.0.1 → 0.0.2
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 +68 -8
- data/lib/omniauth/multiple_providers/version.rb +1 -1
- data/omniauth-multiple_providers.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2a587c796b1c63782f0857c794316e1f0d2024
|
4
|
+
data.tar.gz: 76f395b427c7c63b266dddb2c68f1dc697b21634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f9561cb2a41dfbcb2220ab48f4684984a0dc8356fd02d42ecfa07c0fc24928b355ae992f88be9d85ff2d38c80124483e1b8a97f87cfa2312e25c100acf18ca9
|
7
|
+
data.tar.gz: 7eb08462cae8ac9643cbb108f9b96080849121f3a24dd48f48bc1a841429051dd4ac36da2648112022ac23d076892b92c072495fc9719e9a0953dfbf40e3cd6a
|
data/README.md
CHANGED
@@ -1,16 +1,37 @@
|
|
1
1
|
# Omniauth::MultipleProviders
|
2
2
|
|
3
|
-
|
3
|
+
Support for Omniauth and Multiple Providers.
|
4
|
+
|
5
|
+
## Dependency
|
6
|
+
|
7
|
+
### Devise
|
8
|
+
|
9
|
+
Omniauth::MultipleProviders requires `User` model and `current_user` helper, like Devise.
|
10
|
+
You should create User model, before `rails g omniauth:multiple_providers:install`.
|
11
|
+
ex) do `rails g devise User`
|
12
|
+
|
13
|
+
### Omniauth and Omniauth Strategy
|
14
|
+
|
15
|
+
You should setup Omniauth configuration, before `rails g omniauth:multiple_providers:install`.
|
16
|
+
ex) create config/initializers/omniauth.rb file.
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
gem 'devise'
|
20
|
+
gem 'omniauth'
|
21
|
+
gem 'omniauth-facebook' # etc you needs
|
22
|
+
gem 'omniauth-twitter' # etc you needs
|
23
|
+
```
|
4
24
|
|
5
25
|
## Installation
|
6
26
|
|
7
27
|
Add this line to your application's Gemfile:
|
8
28
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
29
|
+
``` ruby
|
30
|
+
gem 'omniauth'
|
31
|
+
gem 'omniauth-facebook' # etc you needs
|
32
|
+
# ...
|
33
|
+
gem 'omniauth-multiple_providers'
|
34
|
+
```
|
14
35
|
|
15
36
|
And then execute:
|
16
37
|
|
@@ -20,10 +41,49 @@ Or install it yourself as:
|
|
20
41
|
|
21
42
|
$ gem install omniauth-multiple_providers
|
22
43
|
|
44
|
+
`app/models/user.rb` (generated by Devise) do not use `:omniauthable`.
|
45
|
+
|
46
|
+
``` ruby
|
47
|
+
# app/models/user.rb
|
48
|
+
class User < ActiveRecord::Base
|
49
|
+
# Include default devise modules. Others available are:
|
50
|
+
# :token_authenticatable, :confirmable,
|
51
|
+
# :lockable, :timeoutable and :omniauthable # <= do not use
|
52
|
+
devise :database_authenticatable, :registerable,
|
53
|
+
:recoverable, :rememberable, :trackable, :validatable, :confirmable
|
54
|
+
# ...
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
``` sh
|
59
|
+
$ rails generate omniauth:multiple_providers:install
|
60
|
+
$ rake db:migrate # => create provider_users table
|
61
|
+
```
|
62
|
+
|
23
63
|
## Usage
|
24
64
|
|
25
|
-
|
26
|
-
|
65
|
+
You can use `new_omniauth_path(provider: :provider_name)`, and It redirect_to `/auth/:provider_name`.
|
66
|
+
And automatically receive callback, and Save to `ProviderUser`(app/models/provider_user.rb).
|
67
|
+
|
68
|
+
``` haml
|
69
|
+
%ul
|
70
|
+
%li
|
71
|
+
= link_to new_omniauth_path(provider: :twitter), 'data-no-turbolink' => true do
|
72
|
+
Signup with Twitter
|
73
|
+
%li
|
74
|
+
= link_to new_omniauth_path(provider: :facebook), 'data-no-turbolink' => true do
|
75
|
+
Signup with Facebook
|
76
|
+
%li
|
77
|
+
= link_to new_omniauth_path(provider: :github), 'data-no-turbolink' => true do
|
78
|
+
Signup with Github
|
79
|
+
```
|
80
|
+
|
81
|
+
And if you remove connection to Providers,
|
82
|
+
|
83
|
+
``` ruby
|
84
|
+
= link_to omniauth_path(:twitter), method: :delete do
|
85
|
+
cancel connection
|
86
|
+
```
|
27
87
|
|
28
88
|
## Contributing
|
29
89
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["info@takuya.com"]
|
11
11
|
spec.description = %q{Support omniauth for multiple provider}
|
12
12
|
spec.summary = %q{Support omniauth for multiple provider}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "http://github.com/takuyan/omniauth-multiple_providers"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-multiple_providers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takuya Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,7 +87,7 @@ files:
|
|
87
87
|
- lib/omniauth/multiple_providers/models/concerns/omniauthable.rb
|
88
88
|
- lib/omniauth/multiple_providers/version.rb
|
89
89
|
- omniauth-multiple_providers.gemspec
|
90
|
-
homepage:
|
90
|
+
homepage: http://github.com/takuyan/omniauth-multiple_providers
|
91
91
|
licenses:
|
92
92
|
- MIT
|
93
93
|
metadata: {}
|