开发者

Facebook C# SDK throwing Exceptions on ParseCookieValue

开发者 https://www.devze.com 2023-04-06 07:34 出处:网络
We\'re using Facebook connect in an application outside of Facebook, quite regularly the C# Facebook SDK is throwing an exception with this message \"Precondition开发者_开发百科 failed: !cookieValue.C

We're using Facebook connect in an application outside of Facebook, quite regularly the C# Facebook SDK is throwing an exception with this message "Precondition开发者_开发百科 failed: !cookieValue.Contains(",") Session value must not contain a comma."

After doing some research it seems linked to the fact that we're using the JavaScript SDK (for Facebook Connect) and the C# SDK at the same time. As I'm unable to replicate the issue myself I don't have much clue.

UPDATE: In fact the exceptions are happening in prod to "real" users. THE SDK is throwing a hundred of them a day.


Yeah - getting this as well - also using c# SDK and Javascript SDK.

It seems to have happened ONLY to my FB account - when testing my application - and it happened after I had used the wrong app secret in my Oath settings.

It seems that Facebook had TWO access tokens for my personal account - and was trying to store them both in the cookie. I tried using the SDK deleteauthcookie() method, I deleted ALL of Facebook cookies in my browser. No Luck.

The only solution was to remove ALL of the cookies in my browser....

It seems Facebook SOMETIMES tries to store two access tokens in a cookie - separating them with a comma - and c# SDK doesn't like that.


This was a bug in the Facebook C# SDK: http://facebooksdk.codeplex.com/discussions/273578/

Could you remove the following line of code from ParseCookieValue method.

Contract.Requires(!cookieValue.Contains(","), "Session value must not contain a comma.");

This has already been fixed in the latest v5.3.1beta (http://facebooksdk.codeplex.com/releases/view/75790)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号