Add Google oauth2
This commit is contained in:
parent
d9673383a9
commit
fb3e681203
3 changed files with 40 additions and 0 deletions
2
Gemfile
2
Gemfile
|
@ -12,3 +12,5 @@ gem 'jbuilder', '~> 2.0'
|
||||||
gem 'sdoc', '~> 0.4.0', group: :doc
|
gem 'sdoc', '~> 0.4.0', group: :doc
|
||||||
|
|
||||||
gem 'spring', group: :development
|
gem 'spring', group: :development
|
||||||
|
|
||||||
|
gem 'omniauth-google-oauth2', '~> 0.2.5'
|
||||||
|
|
24
Gemfile.lock
24
Gemfile.lock
|
@ -38,6 +38,9 @@ GEM
|
||||||
coffee-script-source (1.8.0)
|
coffee-script-source (1.8.0)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.2.1)
|
execjs (2.2.1)
|
||||||
|
faraday (0.9.0)
|
||||||
|
multipart-post (>= 1.2, < 3)
|
||||||
|
hashie (3.3.1)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
i18n (0.6.11)
|
i18n (0.6.11)
|
||||||
jbuilder (2.1.3)
|
jbuilder (2.1.3)
|
||||||
|
@ -47,11 +50,31 @@ GEM
|
||||||
railties (>= 3.0, < 5.0)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
json (1.8.1)
|
json (1.8.1)
|
||||||
|
jwt (1.0.0)
|
||||||
mail (2.6.1)
|
mail (2.6.1)
|
||||||
mime-types (>= 1.16, < 3)
|
mime-types (>= 1.16, < 3)
|
||||||
mime-types (2.3)
|
mime-types (2.3)
|
||||||
minitest (5.4.2)
|
minitest (5.4.2)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
|
multi_xml (0.5.5)
|
||||||
|
multipart-post (2.0.0)
|
||||||
|
oauth2 (1.0.0)
|
||||||
|
faraday (>= 0.8, < 0.10)
|
||||||
|
jwt (~> 1.0)
|
||||||
|
multi_json (~> 1.3)
|
||||||
|
multi_xml (~> 0.5)
|
||||||
|
rack (~> 1.2)
|
||||||
|
omniauth (1.2.2)
|
||||||
|
hashie (>= 1.2, < 4)
|
||||||
|
rack (~> 1.0)
|
||||||
|
omniauth-google-oauth2 (0.2.5)
|
||||||
|
omniauth (> 1.0)
|
||||||
|
omniauth-oauth2 (~> 1.1)
|
||||||
|
omniauth-oauth2 (1.2.0)
|
||||||
|
faraday (>= 0.8, < 0.10)
|
||||||
|
multi_json (~> 1.3)
|
||||||
|
oauth2 (~> 1.0)
|
||||||
|
omniauth (~> 1.2)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
@ -111,6 +134,7 @@ DEPENDENCIES
|
||||||
coffee-rails (~> 4.0.0)
|
coffee-rails (~> 4.0.0)
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
omniauth-google-oauth2 (~> 0.2.5)
|
||||||
rails (= 4.1.6)
|
rails (= 4.1.6)
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
|
14
config/initializers/omniauth.rb
Normal file
14
config/initializers/omniauth.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
OmniAuth.config.logger = Rails.logger
|
||||||
|
|
||||||
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||||
|
provider :google_oauth2,
|
||||||
|
Rails.application.secrets.google_client_id,
|
||||||
|
Rails.application.secrets.google_client_secret,
|
||||||
|
{
|
||||||
|
client_options: {
|
||||||
|
ssl: {
|
||||||
|
ca_file: Rails.root.join('cacert.pem').to_s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
Loading…
Reference in a new issue