• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 957
  • Last Modified:

Facebook Offline Access .NETSDK

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())
    {
        try
        {
            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)
            {
                fbWebContext.DeleteAuthCookie();
                Session.Clear();
            }
        }
    }

}

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.
0
Arslan306
Asked:
Arslan306
  • 2
2 Solutions
 
Sammy AgeilCommented:
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.
 
0
 
Arslan306Author Commented:
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 ...
0
 
Arslan306Author Commented:
I Found No Solution And I Have Found Myself
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now