← Back to Upcase

Issues with Devise, Devise Confirmable, and Omniauth Facebook

(Mike Adeleke) #1

The players are Devise, Devise Confirmable, and Omniauth Facebook. The issues at hand is that either when I sign up with email or Facebook, the user is not being confirmed in the database and is essentially locked out of the application.

I have provided a series or screenshots to show the issues and will also show the code.

Home page

Signing up with Facebook

Comes back to verify their college email and phone number

Get their confirmation email

They click the link and this is where they go (nowhere really)

When they try to login

In the console, the user has failed to be confirmed yet which may be the issue

omniauth_callbacks_controller.rb (users)

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def facebook     
     @user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)
     if @user.persisted?       
      sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
      set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
    else
      session["devise.facebook_data"] = request.env["omniauth.auth"]
      redirect_to new_user_registration_url
    end
  end
end

I tried something where I deleted the users/show.html.erb and this is what I found

TL;DR

  1. My used upon clicking my confirmation link is not confirmed
  2. I don’t know where they redirect is coming from since I do not have a confirmations model or controller
  3. The user is locked out of the app

EDIT: When I manually change the confirmed_at time in the console I can sign in. So now my question becomes, where should that logic be?

0 Likes

(Kgb4000 ) #2

Hey buddy, I’m very new to rails development, but if it can help, check out railscast episode 360 on facebook outh or some of the other episodes on the subject. There are others that can help you figure this out.

Hope this helps.

Good luck.

0 Likes

(Mike Adeleke) #3

Thanks! I will look at those again.

0 Likes