3

I'm trying to make HttpWebRequest for the facebook url using a WCF service. It gives a bad request error in WCF:

https://graph.facebook.com/search?type=user&access_token=" + Convert.ToString(ConfigurationManager.AppSettings["Facebook_Access_Token1"]) + "&q=" + searchString + "&offset=0&limit=1000&fields=name,link,gender,languages,location,address,education,work,picture

Complete url for reference:

https://graph.facebook.com/search?type=user&access_token=<access_token>&q=f%3DPulkit&offset=0&limit=1000&fields=name,link,gender,languages,location,address,education,work,picture

If I directly try to access this url through browser it gives the below error msg:

{
   "error": {
      "message": "Error validating access token: Session has expired on Sunday, 22-Feb-15 23:22:13 PST. The current time is Monday, 02-Mar-15 04:47:31 PST.",
      "type": "OAuthException",
      "code": 190,
      "error_subcode": 463
   }
}

This code worked fine earlier as a Java Rest service. But now it does not work this way. Any pointers would be helpful. Thanks.

pulkitgulati
  • 41
  • 2
  • 9

1 Answers1

2

You are using an access token that has expired you need to send the user back through the OAuth Login flow.

https://developers.facebook.com/docs/facebook-login/access-tokens#extending

phwd
  • 19,975
  • 5
  • 50
  • 78