QuickBooks PHP API - 无法再次通过 oAuth 流程
QuickBooks PHP API - Can't get through the oAuth process again
首先:我正在使用 https://github.com/consolibyte/quickbooks-php
我不小心断开了应用程序与 "Apps" 页面的连接,试图重新连接(获取新的授权凭证),但看来这是一个错误。
所以现在我正尝试再次完成授权过程,但是当我按照快速入门中所述单击 "docs/example_app_ipp_v3/" 页面上的 "Connect to QuickBooks" 按钮时出现错误指南.
我在这里遗漏了什么吗?我仍然可以通过 API 浏览器进行查询,但是当我在代码中使用 $InvoiceService->query 时似乎无法取回任何数据(只是 returns false)。
//get invoice info
require_once '../includes/quickbooks-php/config.php';
// Set up the IPP instance
$IPP = new QuickBooks_IPP($dsn);
// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
//error_reporting(0);
//ini_set('display_errors', 1);
// Tell the framework to load some data from the OAuth store
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
if ($Context = $IPP->context())
{
// Set the IPP version to v3
$IPP->version(QuickBooks_IPP_IDS::VERSION_3);
$CustomerService = new QuickBooks_IPP_Service_Customer();
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$ItemService = new QuickBooks_IPP_Service_Item();
$PaymentService = new QuickBooks_IPP_Service_Payment();
$invoice_query = $InvoiceService->query($Context, $realm, "SELECT *, Line.* FROM Invoice WHERE Id = '" .QuickBooks_IPP_IDS::usableIDType($main_invoice['qb_invoice_id']). "'");
$this_invoice = array();
var_dump($invoice_query);
if (count($invoice_query)){
foreach ($invoice_query as $Invoice){
//do stuff with invoice here
}
}
}
我从 var_dump($invoice_query) 得到 bool(false),即使它通过 if($Context = $IPP->context())
然后,当我访问 "docs/example_app_ipp_v3/" 页面时,除了配置已更新为我当前的身份验证凭据之外什么都没有,"Connect to Quickbooks" 按钮(下面的 html)将我带到 404 页面。
<ipp:connecttointuit><a href="javascript:void(0)" class="intuitPlatformConnectButton">Connect with QuickBooks</a></ipp:connecttointuit>
您确定 config.php
文件中的 App Token 和其他凭据正确吗?如果它们是 sandbox/dev 个令牌,请 post 配置文件。
您确定配置文件中的 URL 正确吗?如果他们是 sandbox/dev,请 post 他们。
$sandbox
是设置为 TRUE 还是 FALSE?这与您使用的令牌相对应吗?
首先:我正在使用 https://github.com/consolibyte/quickbooks-php
我不小心断开了应用程序与 "Apps" 页面的连接,试图重新连接(获取新的授权凭证),但看来这是一个错误。
所以现在我正尝试再次完成授权过程,但是当我按照快速入门中所述单击 "docs/example_app_ipp_v3/" 页面上的 "Connect to QuickBooks" 按钮时出现错误指南.
我在这里遗漏了什么吗?我仍然可以通过 API 浏览器进行查询,但是当我在代码中使用 $InvoiceService->query 时似乎无法取回任何数据(只是 returns false)。
//get invoice info
require_once '../includes/quickbooks-php/config.php';
// Set up the IPP instance
$IPP = new QuickBooks_IPP($dsn);
// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
//error_reporting(0);
//ini_set('display_errors', 1);
// Tell the framework to load some data from the OAuth store
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
if ($Context = $IPP->context())
{
// Set the IPP version to v3
$IPP->version(QuickBooks_IPP_IDS::VERSION_3);
$CustomerService = new QuickBooks_IPP_Service_Customer();
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$ItemService = new QuickBooks_IPP_Service_Item();
$PaymentService = new QuickBooks_IPP_Service_Payment();
$invoice_query = $InvoiceService->query($Context, $realm, "SELECT *, Line.* FROM Invoice WHERE Id = '" .QuickBooks_IPP_IDS::usableIDType($main_invoice['qb_invoice_id']). "'");
$this_invoice = array();
var_dump($invoice_query);
if (count($invoice_query)){
foreach ($invoice_query as $Invoice){
//do stuff with invoice here
}
}
}
我从 var_dump($invoice_query) 得到 bool(false),即使它通过 if($Context = $IPP->context())
然后,当我访问 "docs/example_app_ipp_v3/" 页面时,除了配置已更新为我当前的身份验证凭据之外什么都没有,"Connect to Quickbooks" 按钮(下面的 html)将我带到 404 页面。
<ipp:connecttointuit><a href="javascript:void(0)" class="intuitPlatformConnectButton">Connect with QuickBooks</a></ipp:connecttointuit>
您确定 config.php
文件中的 App Token 和其他凭据正确吗?如果它们是 sandbox/dev 个令牌,请 post 配置文件。
您确定配置文件中的 URL 正确吗?如果他们是 sandbox/dev,请 post 他们。
$sandbox
是设置为 TRUE 还是 FALSE?这与您使用的令牌相对应吗?