Omniauth + Pow Issue

Posted by neon on Stack Overflow See other posts from Stack Overflow or by neon
Published on 2012-06-07T21:32:04Z Indexed on 2012/06/11 22:40 UTC
Read the original article Hit count: 261

I am having a strange issue with Pow and Omniauth. Omniauth (Facebook Login) works fine when using localhost:3000, but when using Pow (appname.dev) things get fishy.

Users are taken through the redirect and properly created if they don't exist in the database, as they should be. After this, however, they are redirected to the root_path and not signed in. Their record is saved in the database as expected, but sign in does not occur. Again, this is only happening on Pow (and lvh.me), and not on localhost.

Any ideas?

I am using the Devise/Omniauth approach for sign-in, and the controller code looks like this:

  def facebook

    @user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)

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

Again, the user is persisted but there is no flash notice or sign_in that occurs when using POW.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about facebook