How can i authenticate my Quickbook Intuit api access without user interection and just by client id and secret?

huangapple go评论106阅读模式
英文:

How can i authenticate my Quickbook Intuit api access without user interection and just by client id and secret?

问题

我正在进行一个项目,其中后台定时任务创建发票,我希望在后端创建时将它们添加到我的QuickBooks帐户中,所以问题是我只想使用客户端ID和秘密来调用API。

英文:

I am working on a project where backgroung crons create invoices and i want to add them on my quickbook account on create on backend, so problem is i want to hit api with just client id and secret involvement.

答案1

得分: 5

你无法进行无用户交互的Quickbook Intuit API访问身份验证,只使用客户端ID和密钥是不可能的。但实际上你也不需要这样做。你误解了OAuth v2在使用refresh token授权类型时的工作原理。

OAuth v2与refresh token授权类型的工作方式如下:

现在,你可以在需要时使用存储的访问令牌刷新令牌运行你的cron作业。

在某个时刻,你会从Intuit那里收到401响应,这意味着你的访问令牌已过期(只在1小时内有效)。当发生这种情况时:

按需在你的cron进程中重复此操作。需要再次强调的是 - 基于UI的身份验证过程是一次性的,仅一次性的。之后,你将存储令牌,并可以根据需要从后台/cron进程中进行调用。

英文:

> How can i authenticate my Quickbook Intuit api access without user interection and just by client id and secret?

You can't. But you don't need to either. You misunderstand how OAuth v2 works when using refresh token type grants.

The way OAuth v2 with refresh token grants works is like this --

Now, you can run your cron job whenever you want, using the stored access and refresh tokens.

At some point, you will get back a 401 response from Intuit - this means your access token has expired (it is only valid for 1 hour). When this happens:

Repeat in your cron process whenever you want, as desired.

To re-iterate - the UI-based auth process is one-time and one-time ONLY. After that one-time process you store the tokens and can make calls from your background/cron processes whenever you need to.

huangapple
  • 本文由 发表于 2020年1月3日 19:01:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577398.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定