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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:50:48+00:00 2026-06-11T08:50:48+00:00

The question might sound a bit dull at first and I’m baffled myself.. I’m

  • 0

The question might sound a bit dull at first and I’m baffled myself..
I’m developing a PHP application that relies heavily on the Facebook API, thus is using the PHP SDK to connect and getting the currently logged in user via

$fb->getUser();

I have also included the Javascript SDK but its currently only fetching the logged in user and prints their data object to the console.

Today I began to implement a local dev-version of the app, set up a second dev-app on Facebook, connected them and voila.. it doesn’t work.
getUser() always returns 0 for me locally.
What I just found out though is that it works in Firefox.
I var_dump the getUser() value, and recieve a full user id (mine) in Firefox, but 0 in Chrome (and yes, I’m logged in to Facebook on both browsers).

I cleared the cache, cookies, destroyed the session.. I just cant imagine what difference the browser makes for a PHP request to Facebook?
Has anybody ever experienced anything like this?
Obviously the app_key and secret must be correct because it works on Firefox.


Edit: just for reference, the live version of the application (hosted) works well in Chrome, it’s only this very local app that I can’t get to work.


Edit#2: This is the Javascript that I run on the app

  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : {$_connect.app_id}, // App ID
        channelUrl : '{$_connect.channel_file}', // Channel File
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        xfbml      : true  // parse XFBML
      });
    {if !$_user.is_authorized}
    // listen for and handle auth.statusChange events
    FB.Event.subscribe('auth.statusChange', function(response) {
      if (response.authResponse) {
        // user has auth'd your app and is logged into Facebook
        FB.api('/me', function(me){
          if (me.name) {
            console.log(me);
            //window.location = 'index.php';
            // redirection is currently causing loop
          }
        })
      } else {}
    });
    {/if}
    };
    // Load the SDK Asynchronously
    (function(d){
       var js, 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/de_DE/all.js";
       ref.parentNode.insertBefore(js, ref);
     }(document));
  </script>
  • 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-11T08:50:49+00:00Added an answer on June 11, 2026 at 8:50 am

    I just cant imagine what difference the browser makes for a PHP request to Facebook?

    The only thing, of course, can be the parameters.

    And in this scenario, it’s most likely the cookies – the cookies, that Facebook sets on successful login and that the browser has to accept and send back to the server, for the PHP SDK to be able to recognize the logged in user.

    So, check if your Chrome accepts these cookies when you are testing your app locally.

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

Sidebar

Related Questions

I know this question might sound a little bit crazy, but I tough that
This might sound a bit of an odd question but I know what I
I know this question might sound quite silly, but I somehow found myself stuck
I've got a question that might sound strange. We are using node.js, but the
I am going to ask a question that might sound weird. Is there a
I know that might sound like a stupid question since it's a trivial feature
this question might sound a little bit weired... But I will try to explain:
First, my question might sound like a duplicate, but I have been going through
I am new to HTML so this question might sound a bit lame. Anyways
Well I know it might sound a bit strange but yes my question is:

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.