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 9226431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:49:43+00:00 2026-06-18T04:49:43+00:00

I followed the steps here and was running into some problems in merging the

  • 0

I followed the steps here and was running into some problems in merging the accounts

Based on the instructions, I added the following method to my ApplicationController

def after_sign_in_path_for(resource)
  # Merge data from Facebook with her current account
  if session["facebook_data"] && current_user.facebook_uid.nil?
    current_user.facebook_uid = session["facebook_data"]["uid"]
    current_user.save(:validate => false)
  end

  # Countermeasure against session fixation
  session.keys.grep(/^facebook\./).each { |k| session.delete(k) }

  super
end

However, I’m getting a null session[“facebook_data”] in the ApplicationController, even though I’m seeing the correct session value in the callback app/controllers/users/omniauth_callbacks_controller.rb that calls this method:

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def facebook
    user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user)
    if user && user.persisted?
      flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook"
      sign_in_and_redirect user, :event => :authentication
    else
      session["facebook_data"] = env["omniauth.auth"]
      redirect_to new_user_session_url # this redirect invokes the after_sign_in_path_for method in ApplicationController
    end
  end

end

What am I missing here?

  • 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-06-18T04:49:44+00:00Added an answer on June 18, 2026 at 4:49 am

    Out of many reasons, the two reasons worth checking for this:

    1) The session["facebook_data"] in ApplicationController is being called before it is being set in omniauth_callbacks_controller.rb.

    Solution: Check if the calling of the two controllers is in proper synch i.e.

    • It should be first omniauth_callbacks_controller.rb and then ApplicationController.

    2) The value of session["facebook_data"] is reset to null after its set in omniauth_callbacks_controller.rb.

    Solution: Trace the calls after the session["facebook_data"] value set in omniauth_callbacks_controller.rb upto the call to session["facebook_data"] in ApplicationController.

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

Sidebar

Related Questions

I followed the steps here and installed the composite_primary_keys gem. When I try to
I followed the steps here to add the framework: https://hoishing.wordpress.com/2011/08/23/gdata-static-library-for-specific-api/ When I compile I
I followed the steps here: http://tympanus.net/codrops/2009/10/29/jbar-a-jquery-notification-plugin/ I just want it to display a notification
I followed this steps: What I did is edit this file: C:\Windows\System32\drivers\etc\hosts I added
I have followed the steps here : I am using the default feature file.When
I followed the steps here to make my existing WCF service (already working fine
I followed the steps listed here http://wolfpaulus.com/journal/mac/tomcat7 to install Tomcat on Mac and I
I followed Steps to create Hash Key. Downloaded openssl Unzipped and copied all the
I followed steps for package deployment on SQL given in MSDN and it was
I'm developing simple CUDA app. I followed steps given on http://www.ademiller.com/blogs/tech/2010/10/visual-studio-2010-adding-intellisense-support-for-cuda-c/ but still there

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.