我正在尝试在线连接到 QB,但遇到了问题。我为 QBO 创建了一个演示帐户,并将我的测试应用程序添加到该帐户并授予我的应用程序的访问权限。我有我的消费者密钥和秘密令牌。我已经安装了 .net devkit 并设置了我的测试项目。
我正在使用此处的代码示例...
一切正常,直到我调用 add 方法来创建客户。就添加数据而言,我尝试做的任何其他事情也是如此。
这是我得到的错误...
“消息=异常验证 OAuth;errorCode=003200;statusCode=401;源=OAuthStrategy;oauth_problem=token_rejected;原因=net.oauth.OAuthProblemException:token_rejected”
它说令牌被拒绝,所以我不清楚我错过了什么。这些是在线应用部分给我的代币。
这是我的代码..
Dim AccessToken As String = [redacted]
Dim AccessTokenSecret As String = [redacted]
Dim ConsumerKey As String = [redacted]
Dim ConsumerSecret As String = [redacted]
Dim OAuthValidator As OAuthRequestValidator = New OAuthRequestValidator(AccessToken, AccessTokenSecret, ConsumerKey, ConsumerSecret)
Dim Context As ServiceContext = New ServiceContext(OAuthValidator, RealmID, IntuitServicesType.QBD)
Dim dataServices As DataServices = New DataServices(Context)
Dim qbdCustomer As Customer = New Customer()
With qbdCustomer
qbdCustomer.Name = "My New Customer"
qbdCustomer.GivenName = "New Customer"
qbdCustomer.FamilyName = "New Customer"
End With
Dim customerAdded As Customer = dataServices.Add(qbdCustomer)