This is September 2010 and I am trying to update the Facebook Connect integration on our website.
I need this to validate Auth cookies which was determined by the Facebook code. I am following PHP sample from
, please check the C # code:
public stable dictionary & lt; String, string & gt; Parsuki (HTPKKi FBC) {if (FBC == blank) returns the return; String value = fbCookie.Value.Substring (1, fbCookie.Value.Length - 2); SortedDictionary & lt; String, string & gt; Sargs = New ordering & lt; String, string & gt; (); Foreign currency (string pair in value. Sample ('& amp;')) {string [] keyvalue = pair.Split ('='); Sargs.Add (key value [0], keyvalue [1]); } String sid = sargs ["sig"] ?? String.Empty; Sargs.Remove ("sig"); String payload = string. Empty; Forex currency (keywalkeware; pair in strings, string & gt sargs) {payload + = pair K + "=" + pair value; } If (string.IsNullOrEmpty (payload) || dataformer.getmd5 hash (payload + settings. Application cyrcut) .User (!) = Sid.ToUpper ()) blank return; Return sargs.ToDictionary (pair => pair of, pair = gt; value); }
DataFormatter.GetMD5Hash method is:
public static string GetMD5Hash (string key) {StringBuilder result = new StringBuilder (); MD5 md5 = new MD5CryptoServiceProvider (); Forward (MD5) compute hash (UTF 8 encoding.Utf 8.Getbates (key) results in byte B. Appendix (botostring ("x2"); return result; toastring ();}
The problem is that my MD5 does not match sig from facebook .
DataFormatter.GetMD5Hash (payload + settings. Application secret Thanks
P>
Public Stable Dictionary & lt; String, String & gt; Succi (HTPKKi FBC) {if (FBC == blank) returns Null; String value = fbCookie.Value.Substring (1, fbCookie.Value.Length - 2); SortedDictionary & lt; string, string> Sargs = New ordering & Lt; string, string & gt; (); foreign currency (string pair in value. Sample ('& amp;')) {string [] keyvalue = pair.Split ('='); if (keyvalue.Length! = 2) will continue; Sargs.Add (key value [0], significant value [1]);} string sid = sargs ["sig"] ?? string.Empty; Sargs.Remove ("sig"); String payload = sargs.Aggregate (string.Empty, (current, pair) = & gt; current + (pair of + "=" + HttpUtility.UrlDecode (pair.Value))); If (string.IsNullOrEmpty (payload) || DATFORMER. GETMD5Hash (payload + settings .c secret) .User (!) = Sid.ToUpper ()) empty return; Return sargs.ToDictionary (pair => pair of, pair = gt; value); }
Comments
Post a Comment