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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:07:04+00:00 2026-05-31T22:07:04+00:00

Is it possible to force the Facebook session to refresh, or alternatively, call the

  • 0

Is it possible to force the Facebook session to refresh, or alternatively, call the ‘FB.init’ function more than once in a document. I wont go into too much detail with what I am trying to achieve as it is quite long winded, but I have been working on this for a while and it definitely appears to be necessary to do this.

I have a script that is called every 30 seconds that checks if the facebook user is logged in, this is simply achieved with this:

window.fbAsyncInit=function(){
    // Initialize the Facebook object
    FB.init({
        appId:"123",
        status:true,
        cookie:true,
        xfbml:true,
        oauth:true
    });
    // Check the Facebook session status every 30 seconds
    setTimeout(function(){
        // Pass the Facebook object to the welcome function
        fb_welcome(FB);
    ,30000);
};

In the ‘fbWelcome’ function, I test to see if the user is logged in via Facebook using the getLoginStatus function. Dependant on the response, I then alter elements on the page. However, there is one key thing that I do that is making all of this go wrong.

If the user is logged into Facebook, then I send a request to my API using ajax, that returns the Facebook Users details. This API uses PHP to communicate with the Facebook API. If the user was logged into Facebook when the page loaded, there will be no problems. However, if the user was not logged into Facebook, and logs into Facebook on another tab whilst on my site, the session is not refreshed and the details cannot be accessed because the access token and signed request are not valid. I therefore need a way to refresh the access token and signed request in the session using javascript, to make sure they are read correctly by the PHP API.

I am pretty sure that by calling the FB.init function again, this will solve it as it will refresh the session. However, I am not sure if I am meant to call this function more than once per page. Is this permitted? Will it mess things about at all?

Just a few notes:

  1. I am aware that I could retrieve the users details via the Javascript SDK and FB.api, however, I do not want to do this for particular reasons
  2. I am also aware that I can pass the access token and signed request to the PHP API, but I also do not want to do this for particular reasons

Any help much 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-31T22:07:06+00:00Added an answer on May 31, 2026 at 10:07 pm

    Although I have not answered my question, I have solved it using one of the solutions I did not want to use. I am now retrieving the users details using the Javascript API instead of my own API as I cannot get the new Facebook session to pass to the PHP API.

    I tried to call the init function again, and although I was able to, it had absolutely no effect, plus I didn’t really want that to be the solution anyway as I shouldnt have to reinitialize the Facebook library just to refresh the session.

    Anyway, I will leave this open to allow others to give their views, if they have any. It seems that trying to communicate between the PHP and Javascript SDK is a real challenge in some circumstances, the amount of problems I have had with it…

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

Sidebar

Related Questions

Is it possible to force Ruby to call an initialize method when using YAML.load_file?
is it possible to force a thread to return from a call to a
Is it possible to force the user to upgrade once there is a new
Is it possible to force Objective-C to call a specific instance of a virtual
Is it possible to force a column in a SQL Server 2005 table to
Is it possible to force the iPhone to shutdown ( programmatically , of course)?
I would like to know whether it is possible to force LWP::UserAgent to accept
In a Web application, is it possible to force a PDF file to be
In SQL Server 2000/2005, Is it possible to force the default value to be
Even when BorderStyle is set to 0, it is possible to force a window

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.