Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3396024
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:21:31+00:00 2026-05-18T04:21:31+00:00

I have an application configured with authlogic and authlogic_facebook_connect, but every time I click

  • 0

I have an application configured with authlogic and authlogic_facebook_connect, but every time I click to “Connect” button, my UserSession fails validation, saying “You did not provide any details for authentication”

Isn’t the authlogic_facebook_connect supposed to bypass login/password authentication? Am I missing some configuration step?

Any help would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:21:32+00:00Added an answer on May 18, 2026 at 4:21 am

    Hey, maybe I can help on this one, just had this problem not very long time ago…

    Facebook connect is outdated. All the cool kids are now using Facebook Graph with OAuth. Facebook team have even closed the documentation for Facebook Connect.

    Anyway, that goes for Authlogic Facebook connect, it simply does not work anymore.

    In the end, I kept using Authlogic for normal login and account management, but for Facebook connect I wrote my own code.

    Chances are you may have used facebooker gem. Uninstall that gem, but keep the config/facebooker.yml file.

    Try this:

    1. Keep using config/facebooker.yml by adding this code inside config/initializers/load_config.rb (you need to create this file)

      config = YAML.load_file("#{Rails.root}/config/facebooker.yml") || {}

      facebook_config = config['common'] || {}

      facebook_config.update(config[Rails.env] || {})

      FB_CONFIG = facebook_config.symbolize_keys

    2. Add this code inside your user_controller.rb:

    def facebook_oauth_callback
      if not params[:code].nil?
        callback = url_for(:host => APP_CONFIG[:host], :controller => 'gallery/user', :action => 'facebook_oauth_callback')
        url = URI.parse("https://graph.facebook.com/oauth/access_token?client_id=#{FB_CONFIG[:application_id]}&redirect_uri=#{callback}&client_secret=#{FB_CONFIG[:secret_key]}&code=#{CGI::escape(params[:code])}")
        http = Net::HTTP.new(url.host, url.port) http.use_ssl = (url.scheme == 'https') tmp_url = url.path + "?" + url.query
        request = Net::HTTP::Get.new(tmp_url)
        response = http.request(request)
        data = response.body
        access_token = data.split("=")[1]
        if access_token.blank?
          flash[:notice] = 'An error occurred while connecting through Facebook, please try again later.' 
        else
          url = URI.parse("https://graph.facebook.com/me?access_token=#{CGI::escape(access_token)}")
          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = (url.scheme == 'https')
          tmp_url = url.path + "?" + url.query
          request = Net::HTTP::Get.new(tmp_url)
          response = http.request(request)
          user_data = response.body
          user_data_obj = JSON.parse(user_data)
          @user = User.new_or_find_by_facebook_oauth_access_token(access_token, {:user_data => user_data_obj})
    
          if @user.new_record?
            session[:user] = @user
            session[:external_app] = "Facebook"
            redirect_to(:action => 'new_details')
          else
            user_session = UserSession.create(@user)
            flash[:notice] = "Successfully logged in."
            redirect_back_or_default root_url
          end
        end
      end
    end
    
    def create_facebook
      redirect_to("https://graph.facebook.com/oauth/authorize?client_id=#{FB_CONFIG[:application_id]}&redirect_uri=" + 
        url_for(:host => APP_CONFIG[:host], :controller => 'gallery/user', :action => 'facebook_oauth_callback') + 
        "&scope=email,offline_access")
    end
    
    1. Add the find method inside your User model (app/models/user.rb):
          def self.new_or_find_by_facebook_oauth_access_token(access_token, options = {})
            user = User.find_by_facebook_oauth_access_token(access_token)
            if user.blank?
              #code to create new user here
            end
            user
          end
    
    1. Add link to action create_facebook in the view, something like

      <%= link_to image_tag('gallery/button-facebook.png', :title => "register with Facebook", :alt => "register with Facebook"), {:action => 'create_facebook'}, {:target => '_parent'} %>

    Explanation

    1. In the first step you created a file to get config data from facebooker.yml
    2. In second step, you basically created two functions, one for sending user to facebook site (create_facebook) and another to capture the callback data (facebook_oauth_callback) the idea was from this page: http://www.wisejive.com/2010/05/facebook-oauth-on-rails.html
    3. In third step, you just added a method inside User model to find, or create new if not found, a user based on the information returned from facebook.

    The code only works on my project, do not just copy-paste it but learn it line-by-line. Over time I realised it is better to use simple code you can understand rather than using other’s complicated plugin you cannot fix when things go awry…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that configured to run using IIS , but I
In have my application configured in asp.net. I am using ajaxcontroltoolkit. After building the
I have configured my application to use form based authentication and set up the
I have a flex application which is configured with blazeds sever and i am
I have a portlet application. It is configured using Spring framework IoC container. I
In my urls file I have configured the Django admin application to run off
I have an ASP.NET web application that is using forms authentication. Everything is configured
Hi i am testing android E-mail application . I have configured an Exchange account
I have a spring application that has configured log4j (via xml) and that runs
I have flex application consisting of several modules which is configured using maven. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.