class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def facebook # You need to implement the method below in your model @user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user) if @user.persisted? flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook" sign_in @user async_redirect_to user_path(@user) else session["devise.facebook_data"] = env["omniauth.auth"] redirect_to new_user_registration_url end end def open_id # You need to implement the method below in your model @user = User.find_for_open_id(env["omniauth.auth"], current_user) if @user.persisted? flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Google" sign_in @user async_redirect_to user_path(@user) else session["devise.open:id_data"] = env["openid.ext1"] redirect_to new_user_registration_url end end def passthru render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false end end