Class: OmniauthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/omniauth_callbacks_controller.rb

Overview

The omni authentication callbacks controller.

Instance Method Summary (collapse)

Instance Method Details

- (Object) all Also known as: facebook, twitter, google_oauth2

Authenticate different providers.



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/omniauth_callbacks_controller.rb', line 8

def all
  p env['omniauth.auth']
  customer = Customer.from_omniauth(env['omniauth.auth'], current_customer)
  if customer.persisted?
    flash[:notice] = 'Signed in successfully.'
    (customer)
  else
    session['devise.user_attributes'] = customer.attributes
    redirect_to new_customer_registration_url
  end
end

- (Object) failure

Handle authentication fails.



22
23
24
25
26
# File 'app/controllers/omniauth_callbacks_controller.rb', line 22

def failure
  #handle you logic here..
  #and delegate to super.
  super
end