Tuesday, 3 September 2013

Handle facebook expiration token

Handle facebook expiration token

I am having some trouble while integrating facebook API with my desktop
application.
Now, I`m trying to use Facebook SDK for .NET: http://facebooksdk.net/
Here is the problem:
When I use my tokens, Facebook returns the following message:
"Error validating access token: Session has expired at unix time
1365165488. The current unix time is 1378218499."
I saw in some posts that I can do something like this to renew my access
token:
Dictionary<string, object> fbParams = new Dictionary<string, object> ();
fbParams["client_id"] = token.appId;
fbParams["grant_type"] = "fb_exchange_token";
fbParams["client_secret"] = token.appSecret;
fbParams["fb_exchange_token"] = token.accessToken;
JsonObject publishedResponse = fbClient.Get ("/oauth/access_token",
fbParams) as JsonObject;
return publishedResponse["access_token"].ToString ();
But it doesn't work; it throws another exception with the same message
("Session has expired...")
Is there an easy way to do this?
Thank you very much! =)

No comments:

Post a Comment