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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:02:49+00:00 2026-05-12T23:02:49+00:00

I’m using the 3.0 version of the Facebook Developer Toolkit to build an MVC

  • 0

I’m using the 3.0 version of the Facebook Developer Toolkit to build an MVC iframe Facebook app, and having some trouble getting the infinite session key immediately after it is granted.

When the user first hits my application settings View to set their preferences, they just have the usual expiring session key from Facebook. No problem.

Depending on the preferences they select, I prompt them for the offline_access extended permission using the Facebook javascript client library FB.Connect.showPermissionDialog method. Again no problem, they grant the permission.

At this point a new non-expiring (infinite) session key is issued. I need to save this to my database for future use. The problem is, I can’t figure out how to get it immediately when I need it. The Facebook cookies containing the session info are not being updated until a few more page refreshes go by.

There is an open bug in the Facebook bug tracker at bug ID 6421 related to this, but I am looking for a server-side solution using the Facebook Developer Toolkit 3.0 release. I’d like a way to tell the FDT api to go out to Facebook and get the new session.

I know the new session is established on the Facebook side. There is a telltale GET on http://www.facebook.com/extern/login_status.php that shows up in the Firebug Net panel immediately after the user grants the offline_access permission and has a response with some javascript containing the new non-expiring session key. And if I continue using the old expiring session key, I get invalid session errors back from Facebook.

In my controller, I have code like:

[AcceptVerbs(HttpVerbs.Post)]
[FacebookAuthorization(IsFbml = false)]
public ActionResult Index(FormCollection collection)
{
        var api = this.GetApi();
        var userid = api.Session.UserId;
        var key = api.Session.SessionKey;
}

This is getting the old SessionKey, not the new non-expiring one.

I don’t have this problem if I decorate my ActionResult with ExtendedPermissions=”offline_access” on the GET, forcing the user to grant the offline_access prior to even seeing the page, but I don’t like that user experience. I much prefer to prompt using javascript only when needed, and the javascript permissions lightbox is much nicer than the full page width permissions prompt when I use ExtendedPermissions=”offline_access”.

I’ve also tried intercepting the call to my xd_receiver (which I’ve made a View so I can hit a debugger breakpoint in its controller and inspect the incoming request from Facebook). It gets hit during the granting of the extended permission, but again it has the old expiring session info referenced.

So to recap, I am looking for a way using the Facebook Developer Toolkit to force a session refresh from Facebook and get the new infinite session key (and secret).

  • 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-12T23:02:50+00:00Added an answer on May 12, 2026 at 11:02 pm

    Hate to answer my own question, but it sure beats not having a solution. Hope this helps someone else.

    The root cause of the problem is that cookies are not being updated with the new session in a timely fashion, or until the page re-loads. Facebook dev says this is a browser issue. All Facebook client libraries including the .NET Facebook Developer Toolkit rely on the cookies for session info. So it is a browser bug, or a Facebook bug, or a Facebook design flaw to put so much dependence on the cookies. See Facebook bug 6421.

    Fortunately Facebook has a new Javascript client library in alpha which has a cookie-less option that works.

    <div id="fb-root"></div>
    <script type="text/javascript"
        src="http://static.ak.fbcdn.net/connect/en_US/core.js">
    </script>
    
    <script type="text/javascript" >
    
        // initialize the library with the API key, set cookie: false
        FB.init({
            apiKey: your_facebook_apikey,
            cookie: false,
        });
    
        FB.getLoginStatus(function(response) {
            if (response.session) {
                alert(response.session.session_key);
            } else {
                // re-prompt for permissions or do some other exception handling
            }
        }, true); // critical optional parameter to force a refresh
    
    </script>
    

    (omitting facebook permissions prompts and other stuff for brevity)

    In my MVC app I am prompting for permissions in Javascript. Prior to submitting my form, I do the getLoginStatus call and put the sessionkey and secret into form fields so they get posted to the controller.

    The new Javascript client library is on github at http://github.com/facebook/connect-js

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

Sidebar

Ask A Question

Stats

  • Questions 239k
  • Answers 239k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A script tag needs a closing tag to be compliant.… May 13, 2026 at 7:05 am
  • Editorial Team
    Editorial Team added an answer I think the best is if your application does the… May 13, 2026 at 7:05 am
  • Editorial Team
    Editorial Team added an answer The point about C++/CLI is correct. To complete the picture,… May 13, 2026 at 7:05 am

Related Questions

I want use html5's new tag to play a wav file (currently only supported
In order to apply a triggered animation to all ToolTip s in my app,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I've got a string that has curly quotes in it. I'd like to replace

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.