获得“未经授权的 401"通过 Intuit API 访问 quickBooks 数据时出现 .NET 错误 [英] Getting "Unauthorized-401" Error in .NET while accessing quickBooks data through Intuit API

查看:38
本文介绍了获得“未经授权的 401"通过 Intuit API 访问 quickBooks 数据时出现 .NET 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Intuit API 开发带有 QuickBooks 集成的 .NET(C#) 应用程序.我用不同的 QuickBooks 数据创建了 2 个 Intuit 账户,比如 A 和 B.

I am developing a .NET(C#) application with QuickBooks integration using Intuit API. I’ve created 2 Intuit Accounts, say A and B, with different QuickBooks data.

我连接并授权 Intuit 帐户 A,并在我的应用程序中创建了一个客户端 C1.然后我连接并授权 B 并在我的应用程序中创建另一个客户端 C2.到目前为止,一切正常.创建客户端时,我将 oAuth 信息(如访问令牌、访问令牌秘密、密钥等)保存在数据库中.并在我想编辑特定客户端时获取相应信息.

I connect and authorize Intuit account A and create a Client, C1, with same in my application. Then I connect and authorize B and create another Client, C2, in my application. Till this point everything works fine. I save the oAuth information like access token, access token secret, key etc. in database when I create the Clients. And fetch the respective information when I want to edit a particular Client.

(请记住,我的应用程序是在创建 C2 时最后授权的 Intuit 帐户 B)

(Remember my application was last authorized Intuit Account B when C2 was created)

现在,如果我去与 Intuit 账户 A 连接的客户端 C1,并尝试获取 quickbooks 数据,而不通过使用连接到 intuit"按钮的默认连接和授权过程,它会给出我未授权-401"错误,即使我提供了在客户端创建期间保存在本地数据库中的 oAuth 信息,如访问令牌、秘密、密钥等.一旦我启动 API 方法来获取数据,QuickBooks 就会抛出错误.

Now, at this moment, if I go to Client C1 which is connected with Intuit Account A, and try to fetch quickbooks data, without going through default connect and authorize process of intuit using "connect to intuit" button, it gives me "Unauthorized-401" Error, even though I am providing oAuth information like access token, secret, key etc. which was saved in local database during Client creation. QuickBooks throws error as soon as I fire API method to fetch data.

我不希望我的应用程序每次尝试从不同的 Intuit 帐户获取数据时都手动连接和授权 Intuit 帐户进程,因为有一个自动后台作业每 24 小时同步每个客户的 QuickBooks 数据.无法手动授权该作业.

I don’t want my application to manually connect and authorize Intuit account process every time it tries to fetch data from a different Intuit account, As there is an automated background job which sync every Client’s QuickBooks data after every 24 hrs. It is not possible to manually authorize the same with that job.

我在这里缺少什么?我该怎么办?我需要购买任何合作伙伴许可证或其他东西吗?

What I am missing here? What should I do? Do I need to purchase any Partner License or something ?

推荐答案

对于公司文件的主管理员,除非您的应用将 Connect to Quickbooks(C2QB) 用于同一领域,否则令牌不会失效.只有这样才能使令牌无效.请检查您是否将令牌保存在某个临时存储中而不是删除/清理它,这会导致令牌过期.由于两个 QBO 帐户/领域 A 和 B 以及管理员(C1 和 C2)不相关,因此为 B 生成 oauth 令牌没有理由会导致 A 的令牌过期.

For a master admin of a company file, tokens cannot be invalidated unless Connect to Quickbooks(C2QB) is used for the same realm by your app. Only this can render the tokens invalid. Please check if you are saving the tokens in some temp store and not deleting/cleaning it which can cause expiring of tokens. Since, the two QBO accounts/realms A and B and the admins(C1 and C2) are not related, there is no reason that generating the oauth tokens for B could cause tokens to expire for A.

这篇关于获得“未经授权的 401"通过 Intuit API 访问 quickBooks 数据时出现 .NET 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆