Note that there are some explanatory texts on larger screens.

plurals
  1. POC# help required to Create Facebook AppSecret_Proof HMACSHA256
    primarykey
    data
    text
    <p>Facebook requires that I create a appsecret_proof: <a href="https://developers.facebook.com/docs/graph-api/securing-requests" rel="noreferrer">https://developers.facebook.com/docs/graph-api/securing-requests</a></p> <p>And I have done this using the following code:</p> <pre><code>public string FaceBookSecret(string content, string key) { var encoding = new System.Text.ASCIIEncoding(); byte[] keyByte = encoding.GetBytes(key); byte[] messageBytes = encoding.GetBytes(content); using (var hmacsha256 = new HMACSHA256(keyByte)) { byte[] hashmessage = hmacsha256.ComputeHash(messageBytes); return Convert.ToBase64String(hashmessage); } } </code></pre> <p>Everything looks fine for me, however facebook says that the appsecret_proof is invalid. I am logged in, I can do everything as normal when i remove the key. So to save some time:</p> <ul> <li>Yes I am posting to the correct URL</li> <li>Yes I am passing a valid access_token</li> <li>Yes I am using the same access_token in the proof, as i am in the request</li> <li>Yes my appsecret is fine, and works</li> </ul> <p>Example in usage</p> <pre><code>dynamic results = client.Post("/" + model.PostAsId + "/feed", new { message = model.Message, appsecret_proof = FaceBookSecret(postAs.AuthToken, AppSecret) }); </code></pre> <p>I think it probably has something to do with encoding or something along them lines, but to be honest, I just dont know.</p> <p>I am also using the Facebook .net SDK however this does not have much in documentation, and does not seem to strike on anything to do with automation, server side operations etc.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload