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

  • Home
  • SEARCH
  • 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 8276499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:23:37+00:00 2026-06-08T08:23:37+00:00

I’m trying to implement Facebook authentication in our web app, with server side processing

  • 0

I’m trying to implement Facebook authentication in our web app, with server side processing of the Facebook cookie. We use the JavaScript SDK to perform our login and set the cookie.

Somehow, however, the Facebook SDK does not appear to set our fbsr_APPID cookie (or any cookie whatsoever). This is the CoffeeScript code:

window.fbCallbacks = []

   # Create initialization function
window.fbAsyncInit = ->
  fbConfig =
    appId:      '<APPID here>'
    channelUrl: '/assets/channel.html'
    status:     true
    cookie:     true
    xfbml:      true

  FB.init fbConfig

  cb() for cb in window.fbCallbacks

# Set it up
((d)->
    id  = 'facebook-jssdk'
    ref = d.getElementsByTagName('script')[0]
    return if d.getElementById id

    js          = d.createElement 'script'
    js.id       = id
    js.async    = true
    js.src      = "//connect.facebook.net/en_US/all.js"
    ref.parentNode.insertBefore js, ref
)(document)

We let Facebook perform the login via the provided login widget:

<div class="fb-login-button" data-show-faces="true" data-scope="publish_stream"/>

Some extra information:

  • This was tested in Chrome stable and canary as well as IE9, both on localhost and 127.0.0.1, with and without the –enable-file-cookies set (for what it’s worth). I’d say that means it’s not a browser issue.
  • I’ve tried fiddling with the channel file, but it seems perfectly accessible where it is now.
  • Setting a cookie in my own code from JS works like it should.
  • The JS SDK loads fine, because my login widget is properly decorated, and even shows that I’ve logged in already after I did.
  • No errors are reported in the console. It’s completely blank.
  • Replacing the CoffeeScript with a copy from the initialization code JavaScript example on the Facebook Developers does not make it work either.

So what’s happening? Why isn’t Facebook setting my app cookie?

For reference, here is the JavaScript generated by the CoffeeScript above:

(function() {
  window.fbCallbacks = [];
  window.fbAsyncInit = function() {
    var cb, fbConfig, _i, _len, _ref, _results;
    fbConfig = {
      appId: '<appid>',
      channelUrl: '/assets/channel.html',
      status: true,
      cookie: true,
      xfbml: true
    };
    FB.init(fbConfig);
    _ref = window.fbCallbacks;
    _results = [];
    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
      cb = _ref[_i];
      _results.push(cb());
    }
    return _results;
  };
  (function(d) {
     var id, js, ref;
     id = 'facebook-jssdk';
     ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {
       return;
     }
     js = d.createElement('script');
     js.id = id;
     js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     return ref.parentNode.insertBefore(js, ref);
  })(document);
}).call(this);
  • 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-08T08:23:39+00:00Added an answer on June 8, 2026 at 8:23 am

    It appears I misunderstood the SDK. The login button widget does not actually set a cookie locally; it manages authentication and access through Facebook and JavaScript entirely and therefore does not allow you access to an authentication token on the server.

    Using the JS SDK’s FB.login() function did set the cookie.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to render a haml file in a javascript response like so:
We're building an app, our first using Rails 3, and we're having to build
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.