1
0

omniauth_callbacks_controller.rb 550 B

123456789101112131415
  1. class OmniauthCallbacksController < Devise::OmniauthCallbacksController
  2. def action_missing(name)
  3. case name.to_sym
  4. when *Devise.omniauth_providers
  5. service = current_user.services.initialize_or_update_via_omniauth(request.env['omniauth.auth'])
  6. if service && service.save
  7. redirect_to services_path, notice: "The service was successfully created."
  8. else
  9. redirect_to services_path, error: "Error creating the service."
  10. end
  11. else
  12. raise ActionController::RoutingError, 'not found'
  13. end
  14. end
  15. end