public string GetSignature(JObject data) { var hash = InstaCryptoHelper.CalculateHash(ApiVersion.SignatureKey, data.ToString(Formatting.None)); var payload = data.ToString(Formatting.None); var signature = $"{hash}.{payload}"; return(signature); }
public HttpRequestMessage GetSignedRequest(HttpMethod method, Uri uri, AndroidDevice deviceInfo, JObject data) { var hash = InstaCryptoHelper.CalculateHash( ApiVersion.SignatureKey, data.ToString(Formatting.None)); var payload = data.ToString(Formatting.None); var signature = $"{hash}.{payload}"; var fields = new Dictionary <string, string> { { InstaApiConstants.HeaderIgSignature, signature }, { InstaApiConstants.HeaderIgSignatureKeyVersion, InstaApiConstants.IgSignatureKeyVersion } }; var request = GetDefaultRequest(HttpMethod.Post, uri, deviceInfo); request.Content = new FormUrlEncodedContent(fields); request.Properties.Add(InstaApiConstants.HeaderIgSignature, signature); request.Properties.Add( InstaApiConstants.HeaderIgSignatureKeyVersion, InstaApiConstants.IgSignatureKeyVersion); return(request); }