kirushik/critical_chain

View on GitHub
app/controllers/users/omniauth_callbacks_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def google_oauth2
      # You need to implement the method below in your model (e.g. app/models/user.rb)
      @user = User.from_omniauth(request.env['omniauth.auth'], current_user)

      raise 'Failed to get persisted user from omniauth data' unless @user.persisted?

      flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', :kind => 'Google'
      sign_in_and_redirect @user, :event => :authentication
  end
end