我正在开发一个由backgroung crons创建发票的项目,并且我想将它们添加到后端创建时的Quickbook帐户中,所以问题是我想仅通过客户端ID和秘密参与来打入api。
我如何在没有用户交互的情况下,仅通过客户端ID和密码来验证我的Quickbook Intuit api访问权限?
你不能。
但是您也不需要。您误解了使用refresh token
类型授权时OAuth v2的工作方式。
refresh token
的OAuth v2授予的工作方式是这样-client ID
和client secret
,并定义回调URL-https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0#download-the-oauth-library拥有QuickBooks Online
帐户的人经历了client ID
和client secret
交换为authorization code
,然后是access token
和refresh token
-https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0#step-1-prepare-authorization-request您的代码access
和refresh tokens
。 现在,您可以随时运行cron
作业,使用存储的access
和refresh tokens
401
响应-这表示您的access token
已过期(仅有效1小时)。发生这种情况时:access token
-https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0#refresh-the-tokenaccess token
和新的refresh token
(您可能会也可能不会取回新的刷新令牌,因此无论何时,您都应该只存储每次取回的内容)再次进行您的API调用,它将成功要重申-基于UI的身份验证过程是
一次性