I keep getting "Not Found. Passthru Authentication" to login to Facebook to connect using Devise - Need to debug

I saw a couple people ask a similar question, but I really need advice on debugging this problem. I am trying to set up a facebook connection using Devise using the article here: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

Each time I click on the login with a link to facebook, I get a blank page that simply says: Not found. Authentication passthru. Obviously, there is no JavaScript / ajax installation on the previous page to bring up the facebook login screen.

I know this can work on my system since I made an empty project with the same code from the link above and it works. Of course, my project is much larger with lots of code, so I'm trying to figure out what is causing this to fail in my project.

Any debugging help is appreciated.

Thanks!

+4
source share
2 answers

This is the #passthru code from the development source.

def passthru render :status => 404, :text => "Not found. Authentication passthru." end 

This means that the developer cannot recognize the facebook callback. Make sure you configure the callback controller correctly or place your user controller code.

0
source

I came across the same error. I missed the Facebook callback controller (app / controllers / users / omniauth_callbacks_controller.rb):

 class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController # ... def facebook respond_to do |format| format.html { @user = User.find_for_facebook(request.env["omniauth.auth"]) if @user.persisted? sign_in_and_redirect @user 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 end 

This code refers to the "find_for_facebook" method in my user model (app / models / user.rb):

 class User < ActiveRecord::Base # ... def self.find_for_facebook(auth_hash) user = User.where(:email => auth_hash.info["email"]).first unless user user = User.create( username: auth_hash.info["nickname"], email: auth_hash.info["email"], password: Devise.friendly_token[0,20]) end user.provider = auth_hash["provider"] user.uid = auth_hash["uid"] user end end 

Be sure to restart the development server so that all changes are received.

0
source

Source: https://habr.com/ru/post/1482780/


All Articles