Facebook Offline Access .NETSDK

Posted on 2011-05-06
Last Modified: 2012-05-11
Hi All,

I am working on facebook application. I am getting the offline access permission from my app user. Now I want that I can use the same tokens that generated one time when user uses first time my app and i will store this token in my db and whenever the user will login again on our site and want to publish some wall post through our app we will use the same token for publishing on wall.

Here is my Codesnip

protected void Page_Load(object sender, EventArgs e)
 var auth = new CanvasAuthorizer { Permissions = new[] { "user_about_me", "publish_stream", "video_upload", "share_item", "photo_upload", "offline_access" } };

    var fbWebContext = FacebookWebContext.Current;
    if (fbWebContext.IsAuthorized())
            var fb = new FacebookWebClient(fbWebContext);
            var token = fb.AccessToken;  \\ Im Getting Token This Way When its Generated From User After Getting Extended Permission
            dynamic result = fb.Get("/me");
            long id = fbWebContext.UserId;
        catch (Exception ex)
            if ("(OAuthException) Error validating access token: The session is invalid because the user logged out or because auth.expireSession was invoked." == ex.Message)


Now Im getting the Access Token Like This Way "var token = fb.AccessToken;" Now Im Using That Token It Says You Token is Expired at Unix Time xxxxxxxxxx. Can You Please tell me anyone If this is Access Token After Extended Permission of offline Access Then Why its Saying its Saying Your Access token is Expired. Can Please Any One Help Me Out in This Problem.
Question by:Arslan306
    LVL 27

    Assisted Solution

    Regardless of the app, access tokens are usually time limited. if facebook allows you to save a token how would they guarantee that wont take over the users account? that shouldn't be even legal to do.

    Accepted Solution

    Hi Sammy

    First let me clear you. I think you are mistaken. The thing is its Legal to use. You can go to facebook developer. And Read about that Offline_Access permissions. Then Thousand of Apps on Facebook are doing that Like Farmville, FishVille, Mean All Zynga Games. And All Offline Access Token Not Gave You All Access Like Your Security Question And Password Access. Its Have Limited Permission. Anyway I Would Suggest You, You Must Read Documentation on Facebook Developer Site.
    And FYI I am using Facebook Offline Access Token In My Application. So Its Legal My Dear. Anyway I Found No Help In Expert Exchange. Its Really Bad ...

    Author Closing Comment

    I Found No Solution And I Have Found Myself

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now