add oauth with google

This commit is contained in:
João Geonizeli
2022-07-20 22:22:41 -03:00
parent 072e1de01b
commit ae7d31bc1b
9 changed files with 74 additions and 6 deletions

View File

@@ -18,6 +18,10 @@ require "action_cable/engine"
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
if ['development', 'test'].include? ENV['RAILS_ENV']
Dotenv::Railtie.load
end
module ProgressTest
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.

View File

@@ -271,7 +271,12 @@ Devise.setup do |config|
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
config.omniauth(
:google_oauth2,
ENV['GOOGLE_OAUTH_CLIENT_ID'],
ENV['GOOGLE_OAUTH_CLIENT_SECRET'],
{}
)
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or

View File

@@ -1,5 +1,5 @@
Rails.application.routes.draw do
devise_for :users
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Defines the root path route ("/")