Class: Users::OmniauthCallbacksController

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

Instance Method Summary collapse

Instance Method Details

#facebookObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/devise_omniauth/users/omniauth_callbacks_controller.rb', line 3

def facebook

  auth = DeviseOmniauth::Authentication.find_or_create_for_facebook_oauth(request.env["omniauth.auth"], current_user)
  @user = auth.user

  if @user.persisted?
    flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook"
     @user, :event => :authentication
  else
    session["devise.facebook_data"] = request.env["omniauth.auth"]
    redirect_to new_user_registration_url
  end
end