adds Google OAuth2 support
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -24,7 +24,7 @@ gem 'devise'
|
||||
gem 'omniauth'
|
||||
gem 'omniauth-twitter'
|
||||
gem 'omniauth-facebook'
|
||||
# gem 'omniauth-google-oauth2'
|
||||
gem 'omniauth-google-oauth2'
|
||||
|
||||
gem 'kaminari'
|
||||
gem 'acts_as_commentable_with_threading'
|
||||
|
||||
@@ -213,6 +213,9 @@ GEM
|
||||
rack (~> 1.0)
|
||||
omniauth-facebook (2.0.1)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-google-oauth2 (0.2.6)
|
||||
omniauth (> 1.0)
|
||||
omniauth-oauth2 (~> 1.1)
|
||||
omniauth-oauth (1.1.0)
|
||||
oauth
|
||||
omniauth (~> 1.0)
|
||||
@@ -391,6 +394,7 @@ DEPENDENCIES
|
||||
letter_opener_web (~> 1.3.0)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-google-oauth2
|
||||
omniauth-twitter
|
||||
paranoia
|
||||
pg
|
||||
|
||||
@@ -15,8 +15,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
}
|
||||
end
|
||||
|
||||
# [:twitter, :facebook, :google_oauth2].each do |provider|
|
||||
[:twitter, :facebook].each do |provider|
|
||||
[:twitter, :facebook, :google_oauth2].each do |provider|
|
||||
provides_callback_for provider
|
||||
end
|
||||
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
|
||||
<%= link_to t("omniauth.twitter.sign_in"), user_omniauth_authorize_path(:twitter), class: 'button radius expand' %>
|
||||
<%= link_to t("omniauth.facebook.sign_in"), user_omniauth_authorize_path(:facebook), class: 'button radius expand' %>
|
||||
<%= link_to t("omniauth.google_oauth2.sign_in"), user_omniauth_authorize_path(:google_oauth2), class: 'button radius expand' %>
|
||||
|
||||
<hr/>
|
||||
|
||||
@@ -6,4 +6,6 @@
|
||||
twitter_secret: <%= ENV["TWITTER_SECRET"] %>
|
||||
facebook_key: <%= ENV["FACEBOOK_KEY"] %>
|
||||
facebook_secret: <%= ENV["FACEBOOK_SECRET"] %>
|
||||
google_oauth2_key: <%= ENV["GOOGLE_KEY"] %>
|
||||
google_oauth2_secret: <%= ENV["GOOGLE_SECRET"] %>
|
||||
server_name: <%= fetch(:server_name) %>
|
||||
|
||||
@@ -241,6 +241,7 @@ Devise.setup do |config|
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||
config.omniauth :twitter, Rails.application.secrets.twitter_key, Rails.application.secrets.twitter_secret
|
||||
config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret
|
||||
config.omniauth :google_oauth2, Rails.application.secrets.google_oauth2_key, Rails.application.secrets.google_oauth2_secret
|
||||
|
||||
# ==> Warden configuration
|
||||
# If you want to use other strategies, that are not supported by Devise, or
|
||||
|
||||
@@ -155,3 +155,5 @@ en:
|
||||
sign_in: Sign in with Twitter
|
||||
facebook:
|
||||
sign_in: Sign in with Facebook
|
||||
google_oauth2:
|
||||
sign_in: Sign in with Google
|
||||
|
||||
@@ -155,3 +155,5 @@ es:
|
||||
sign_in: Entra con Twitter
|
||||
facebook:
|
||||
sign_in: Entra con Facebook
|
||||
google_oauth2:
|
||||
sign_in: Entra con Google
|
||||
|
||||
@@ -18,6 +18,8 @@ development:
|
||||
twitter_secret: BBBB
|
||||
facebook_key: AAAA
|
||||
facebook_secret: BBBB
|
||||
google_oauth2_key: AAAA
|
||||
google_oauth2_secret: BBBB
|
||||
<<: *default
|
||||
|
||||
test:
|
||||
@@ -26,6 +28,8 @@ test:
|
||||
twitter_secret: BBBB
|
||||
facebook_key: AAAA
|
||||
facebook_secret: BBBB
|
||||
google_oauth2_key: AAAA
|
||||
google_oauth2_secret: BBBB
|
||||
<<: *default
|
||||
|
||||
production:
|
||||
@@ -34,4 +38,6 @@ production:
|
||||
twitter_secret: <%= ENV["TWITTER_SECRET"] %>
|
||||
facebook_key: <%= ENV["FACEBOOK_KEY"] %>
|
||||
facebook_secret: <%= ENV["FACEBOOK_SECRET"] %>
|
||||
google_oauth2_key: <%= ENV["GOOGLE_KEY"] %>
|
||||
google_oauth2_secret: <%= ENV["GOOGLE_SECRET"] %>
|
||||
<<: *default
|
||||
|
||||
Reference in New Issue
Block a user