带有 oauth2 的 Quickbooks 在线 API [英] Quickbooks online API with oauth2

查看:24
本文介绍了带有 oauth2 的 Quickbooks 在线 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 Quickbooks 在线 API 在我的系统和我客户的 Quickbooks 帐户之间同步数据.

I need to use Quickbooks online API to synchronize data between my system and my client's accounts on quickbooks.

我需要知道是否可以在无需人工交互的情况下完成 oauth2 授权流程并进行 API 调用(无需与 Intuit 的身份验证和授权窗口交互)?

I need to know if is it possible to complete the oauth2 authorization flow and make API calls without human interaction (without the need to interact with Intuit's authentication and authorization windows)?

我阅读了 Intuit 的文档:com/docs/0100_quickbooks_online/0100_essentials/000500_authentication_and_authorization/connect_from_within_your_app

I read the Intuit's docs on: https://developer.intuit.com/docs/0100_quickbooks_online/0100_essentials/000500_authentication_and_authorization/connect_from_within_your_app

在第一步中,我向以下对象发出了 GET 请求:

On the first step, I made a GET request to:

https://appcenter.intuit.com/connect/oauth2?client_id=MY_ID&scope=com.intuit.quickbooks.accounting&redirect_uri=https%3A%2F%2FMY_NGROK_URL.ngrok.io%2FOAuth2PHPExample.php&response_type=code&state=RandomState#/Authorize/COMPANY_ID

然后,Intuit 的身份验证和授权窗口打开,我需要输入我的用户名和密码,然后单击授权按钮以获取授权代码.

Then, the Intuit's authentication and authorization windows opens and I need to put my username and password and then, click in the authorize button to get the authorization code.

有没有办法不用认证授权就可以获取授权码?

Is there a way to obtain the authorization code without authenticate and authorize?

我需要自动执行此任务,以便在后端使用 PHP 进行 API 调用.

I need to automate this task to make API calls in the backend with PHP.

谢谢,马塞洛.

推荐答案

有没有办法不用认证授权就可以获取授权码?

Is there a way to obtain the authorization code without authenticate and authorize?

不...但请阅读以下内容.

No... but read below.

我需要自动执行此任务,以便在后端使用 PHP 进行 API 调用.

I need to automate this task to make API calls in the backend with PHP.

您误解了 OAuth(1 或 2)的工作原理.

You are misunderstanding how OAuth (either 1 or 2) works.

第一次连接时,系统会提示您验证/授权访问 QuickBooks Online 数据.

The very first time you connect you will be prompted to authenticate/authorize access to the QuickBooks Online data.

然后会为您提供刷新令牌(或访问令牌,具体取决于您使用的是 OAuth2 还是 OAuth1).

You are then given a refresh token (or access token depending on if you're using OAuth2 vs. OAuth1).

然后您存储该刷新令牌(或 OAuth1 的访问令牌),并且可以使用该令牌在无人看管的情况下提出您的请求,根本不需要用户参与.

You then store that refresh token (or access token for OAuth1) and can use that token going forward to make your requests, unattended, without requiring the user to be involved at all.

关键要点:您只需要用户在您第一次连接时就参与其中,之后就再也不需要了.

这篇关于带有 oauth2 的 Quickbooks 在线 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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