Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Google Identity Platform support #324

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -42,6 +42,7 @@ gem 'libv8', '~> 3.16.14.7'
gem 'stripe', git: 'https://github.com/stripe/stripe-ruby'
gem 'high_voltage'
gem 'omniauth-facebook'
gem 'omniauth-google-oauth2'
gem 'omniauth-strava'
gem 'omniauth'
gem 'fog'
Expand Down
2 changes: 1 addition & 1 deletion app/models/integration.rb
Expand Up @@ -16,7 +16,7 @@ def self.old_attr_accessible
before_create :associate_with_user
def associate_with_user
self.provider_name ||= information['provider']
if provider_name == 'facebook' || provider_name == 'strava'
if provider_name == 'facebook' || provider_name == 'strava' || provider_name == 'google'
update_or_create_user(email: information['info']['email'], name: information['info']['name'])
end
end
Expand Down
3 changes: 2 additions & 1 deletion config/initializers/omniauth.rb
@@ -1,4 +1,5 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], scope: 'email'
provider :strava, ENV['STRAVA_KEY'], ENV['STRAVA_SECRET'], scope: 'public'
end
provider :google, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'], scope: 'email'
end
8 changes: 8 additions & 0 deletions spec/fixtures/integration_data_google.json
@@ -0,0 +1,8 @@
{
"provider": "google",
"credentials": {
},
"extra": {
}
}
}