gpt4 book ai didi

quickbooks - Intuit QuickBooks token 更新和到期

转载 作者:行者123 更新时间:2023-12-05 01:09:24 28 4
gpt4 key购买 nike

我正在使用 QB 桌面版。我想为我的 QuickBooks 桌面版续订/重新生成“访问 token ”/“访问 token secret ”,因为它们将在 180 天内到期,并且必须在 token 到期后的 30 天内进行续订。
我用下面的代码尝试了同样的方法,但它不起作用,给出错误,

<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2"><Error RequestId="14aa97c48321489db48254e4bdb25d00"><RequestName>ErrorRequest</RequestName><ProcessedTime>2013-04-05T11:43:08+00:00</ProcessedTime><ErrorCode>401</ErrorCode><ErrorDesc>Invalid security token</ErrorDesc></Error></RestResponse>

token 生成没有任何记录的请求/响应。
 string myRealmId = "000000000000000";
string myAccessToken = "0000000000000000000000000000000000000";
string myAccessTokenSecret = "00000000000000000000000000000000000";

string myAppToken = "00000000000000000000000000000000000";
string myConsumerKey ="00000000000000000000000000000000000";
string myConsumerSecret ="00000000000000000000000000000000000";

OAuthConsumerContext consumerContext = new OAuthConsumerContext
{
ConsumerKey =myConsumerKey,
SignatureMethod = SignatureMethod.HmacSha1,
ConsumerSecret = myConsumerSecret
};

OAuthSession oSession = new OAuthSession(consumerContext, "https://oauth.intuit.com/oauth/v1/get_request_token",
"https://workplace.intuit.com/Connect/Begin",
"https://oauth.intuit.com/oauth/v1/get_access_token");

oSession.ConsumerContext.UseHeaderForOAuthParameters = true;

oSession.AccessToken = new TokenBase
{
Realm = myRealmId,
Token = myAccessToken,
ConsumerKey = myConsumerKey,
TokenSecret = myAccessTokenSecret
};

var body = "<AdvancedReportQuery xmlns=\"http://www.intuit.com/sb/cdm/v2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.intuit.com/sb/cdm/v2 ..//RestDataFilter.xsd\"><BalanceSheetStd><OfferingId>ipp</OfferingId><EndTransactionDate>2012-06-01</EndTransactionDate></BalanceSheetStd></AdvancedReportQuery>";

IConsumerRequest conReq = oSession.Request();
conReq = conReq.Post().WithRawContentType("text/xml").WithRawContent(System.Text.Encoding.ASCII.GetBytes(body));
conReq = conReq.ForUrl("https://services.intuit.com/sb/advancedreport/v2/508053445");
try
{
conReq = conReq.SignWithToken();
}
catch (Exception ex) {}

string serviceResponse = conReq.ReadBody();

}
catch (Exception Err) {}

}

谢谢,

瑞诗玛 D.

最佳答案

您需要在 token 到期前 30 天内调用 Reconnect API。您的 token 似乎已经过期,因此您需要再次通过 Oauth 流程。

http://docs.developer.intuit.com/0025_Intuit_Anywhere/0060_Reference/3002_Reconnect_API

使用 DevDefined 和 DevKit 的 C# 示例:

https://gist.github.com/IntuitDeveloperRelations/5338762

关于quickbooks - Intuit QuickBooks token 更新和到期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15833117/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com