Class: Auth::OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- Auth::OmniauthCallbacksController
- Defined in:
- app/controllers/auth/omniauth_callbacks_controller.rb
Instance Method Summary collapse
-
#eventbrite ⇒ Object
Omniauth callback for Eventbrite.
- #failure ⇒ Object
Instance Method Details
#eventbrite ⇒ Object
Omniauth callback for Eventbrite.
Adds an Eventbrite Service to the Serviceable serviceable_type
, serviceable_id
with the creator of user_id
.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/auth/omniauth_callbacks_controller.rb', line 7 def eventbrite auth = request.env['omniauth.auth'] token = auth['credentials']['token'] params = request.env['omniauth.params'] redirect_link = params.key?('redirect_link') ? params['redirect_link'] : '' serviceable_id = params['serviceable_id'] serviceable_type = params['serviceable_type']&.camelize user_id = params['user_id'] render status: :not_found and return unless Serviceable.serviceable?(serviceable_type, serviceable_id, user_id) service = { creator_id: user_id, name: :eventbrite, serviceable_id: serviceable_id, serviceable_type: serviceable_type, token: token } Service.upsert(service, unique_by: :unique_serviceable_index) redirect_to Rails.configuration.frontend_url + redirect_link end |
#failure ⇒ Object
26 27 28 |
# File 'app/controllers/auth/omniauth_callbacks_controller.rb', line 26 def failure redirect_to Rails.configuration.frontend_url end |