[英]How to generate oauth_signature intuit ipp QBO API V3
I am having some issues with limitations of the .NET SDK and so would like to issue my own calls to the API and parse the JSON results. 我遇到了一些.NET SDK限制的问题,因此我想发出自己的API调用并解析JSON结果。 I am stuck on creating the authorization header parameter oauth_signature as outlined here . 我坚持打造概括的授权头参数oauth_signature 这里 。
For this parameter it states: Contains the value generated by running all other request parameters and two secret values through a signing algorithm
对于此参数,它指出: Contains the value generated by running all other request parameters and two secret values through a signing algorithm
What I have so far. 到目前为止我有什么。
public static string GetOAuthAuthorization(string oauthToken, string oauthSecret, string consumerKey, string consumerSecret)
{
string oauth_token = oauthToken;
string oauth_nonce = Guid.NewGuid().ToString();
string oauth_consumer_key = consumerKey;
string oauth_signature_method = "HMAC-SHA1";
int oauth_timestamp = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
string oauth_version="1.0";
string dataString = oauth_token + oauth_nonce + oauth_consumer_key + oauth_timestamp;
//TODO: use following to create oauth_signature
byte[] hashkey = Encoding.ASCII.GetBytes(oauthSecret); //is this one of the secret values?
byte[] data = Encoding.ASCII.GetBytes(dataString);
HMACSHA1 hmac = new HMACSHA1(hashkey);
byte[] result = hmac.ComputeHash(data);
string oauth_signature=Convert.ToBase64String(result);
return string.Format("OAuth oauth_token='{0}',oauth_nonce='{1}',oauth_consumer_key='{2}',oauth_signature_method='{3}',oauth_timestamp='{4}',oauth_version='{5}',oauth_signature='{6}'",
oauth_token, oauth_nonce, oauth_consumer_key, oauth_signature_method,oauth_timestamp,oauth_version, oauth_signature
);
}
Please check the sample app provided by Intuit for V3. 请查看Intuit for V3提供的示例应用程序。 This is already implemented. 这已经实施了。 You can set in your keys and debug- 您可以设置密钥并调试 -
https://github.com/IntuitDeveloperRelations/ https://github.com/IntuitDeveloperRelations/
When you had generated an app with IPP, you must have got a consumer key and consumer secret. 当您使用IPP生成应用程序时,您必须拥有使用者密钥和使用者密钥。 That is what is being referred in the line you have mentioned. 这就是你提到的那条线。
https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started
For other questions, just debug the sample code after setting in your app keys in web.config, you will get the answers. 对于其他问题,只需在web.config中的应用程序密钥中设置后调试示例代码,您将获得答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.