OAuthException with post action only in IE

2019-08-12 06:27发布

In my fb application I calling a post action

$.post("http://localhost:3435/Home/Try?id=123&x=1");

My action

[HttpPost]
public ActionResult Try(string id, int x)
{
  //post on my wall
  var client = new FacebookWebClient();
  dynamic parameters = new ExpandoObject();
  //...
  dynamic result = client.Post("me/feed", parameters);
  //...
}

In FF and chrome this works as expected. Posts to wall. But in Internet Explore I get an exception. (OAuthException) An active access token must be used to query information about the current user.

Some answers in similar question suggested to get the acces token from the FacebookSetting, but this seems to be null when debugged. I find this very strange since this works in FF and Mozilla.

2条回答
祖国的老花朵
2楼-- · 2019-08-12 06:46

You will need to manually maintain the signed_request for post backs or ajax requests.

Pass signed_request as a parameter to your ajax post request.

More details at http://facebooksdk.codeplex.com/discussions/251878 and http://facebooksdk.codeplex.com/discussions/250820

查看更多
我想做一个坏孩纸
3楼-- · 2019-08-12 07:00

hmm check if IE has flash installed for x-domain communication, if not, try installing, also try hitting the apps.facebook.com/yourapp instead of going directly to the iframe

oh 1 other thing it could be if it's an iframe, is 3rd party cookies, try adding header('P3P: CP=HONK'); to your php code

查看更多
登录 后发表回答