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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:49:07+00:00 2026-05-25T21:49:07+00:00

I have registered with auth.login in order to do an ajax call back to

  • 0

I have registered with auth.login in order to do an ajax call back to my server and update login counts. it doesnt work as the php sdk is resolutely refusing to see that the user is properly logged in.

JS code:

    window.fbAsyncInit = function () {
    var channelurl='http://'+window.location.hostname+'/channel.html';
        FB.init({
            appId : window.appid,
            status: true,
            cookie: true,
            xfbml: true,
            channelURL : channelurl, // channel.html file
            oauth  : true // enable OAuth 2.0
        });
        FB.Event.subscribe('auth.login', function (response) {

                   $("#fbconnecttext").html("<a>Logging in...</v>");

                   $.ajax({
                      url: "fbupdatelogincount",
                      type: "GET",
                      cache: false,
                      success: function (html) {
                          window.setTimeout('$("#fbconnecttext").html("")', 10000);
                          var rec = JSON.parse(html);
                          window.numlogins = rec["numlogins"];
                          FB.api('/me', function (response) {
                             if (window.numlogins > 1) {
                                 $("#fbconnecttext").html(window.welcomebacktext.replace("%s", response.first_name));
                                 $("#fbadminimg").attr("src", "common-images/smiley");
                             }
                             else {
                                 alert(window.firstlogintext.replace("%s", response.first_name));
                             }

                             });

                      }
                      });
               });

        FB.Event.subscribe('auth.logout', function (response) {
                   $("#fbconnecttext").html(window.fbconnecttext);
                   $("#fb-like").show();
                   FB.XFBML.parse($('#fb-like').is());
               });
        FB.Event.subscribe('auth.sessionChange', function (response) {});
    };

(function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "http://connect.facebook.net/en_US/all.js";
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
}

The php page

require_once("utils.php");
logText("In  fbUpdatelogincount");
if(fbAuthentication()){
    logText("authenticated in  fbUpdatelogincount");
    $r=fbUpdateStats();
    if(isset($_REQUEST["field"]))
        echo $r[$_REQUEST["field"]];
    else
        echo json_encode($r);
}
echo "";

And finally the fbAutentication code:

function fbAuthentication(){

    global $facebook;
    $facebook = new Facebook(array(
                     'appId' => getSetting("fb:app_id"),
                     'secret' => getSetting("fb:secret")
                     ));
    if($facebook->getUser()){
        try {
            global $fb_isadmin,$fb_me;
            $fb_me = $facebook->api('/me');
            $fb_isadmin=strstr(getSetting("fb:admins"),$facebook->getUser())!=false;
            fbUpdateStats();
            return true;
        } catch (FacebookApiException $e) {
            /* exception handling todo */
        }
        return true;
    }else logText("No Valid user");

    return false;

}

The main issue is the ajax call firing up the url fbupdatelogincount but the PHP side saying “nope, no one is logged in”. Any ideas? Same setup worked fine prior to 3.1.1

  • 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-25T21:49:07+00:00Added an answer on May 25, 2026 at 9:49 pm

    This doesn’t seem to be documented anywhere, but it seems that passing the application secret to the auth.login event causes it to fire successfully.

    Try this:

    FB.Event.subscribe('auth.login', function(response) {
        // callback
    }, { secret:'<?php print $facebook->getApiSecret(); ?>' });
    

    The original issue has since been fixed by Facebook.

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

Sidebar

Related Questions

Hi I have registered in Google AdSense and I want to use SDK for
I am having trouble getting the Auth component redirect. I have a login form
I have implemented ntlmv2 for lync-server login in an custom made lync client.The message
I have registered an enumeration type ClefType within my header file - this enum
I have registered ProximityAlert in MapActivity. No problem with catching alerts in BroadcastReceiver and
I have registered a component like this in my Global.asax.cs: ContainerBuilder builder = new
I have a table of recent web guest who have registered. One of the
I have developed a android application using phonegap. I have registered certain recievers which
I have a basic project with areas in it, I have registered my routes
I am using the MVP design pattern and I have registered my presenter as

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.