我在 PHP 中为 SageOne Accounts Cloud Software找到了一个 API 类 ( https://github.com/eddieharrison/sageone-api-php )。
我使用在auth.php
我的应用程序 CLIENT_ID 和 CLIENT_SECRET 中找到的代码来获取访问代码。
然后我尝试了这段代码(/examples/get-ledger-accounts.php):
define('SAGE_CLIENT_ID', 'my client id');
define('SAGE_CLIENT_SECRET', 'my client secret');
// If you do not already have an access token please see:
// /examples/auth.php
define('SAGE_ACCESS_TOKEN', 'access code from auth.php');
$client = new SageOne(SAGE_CLIENT_ID, SAGE_CLIENT_SECRET);
$client->setAccessToken(SAGE_ACCESS_TOKEN);
$result = $client->getLedgerAccounts();
echo '<pre>';
print_r($result);
echo '</pre>';
但是,在测试此代码时,我得到以下信息:
string(26) "{"error":"invalid_token"} " int(0)
Array
(
[error] => invalid_token
)
有谁知道这意味着什么以及如何修复它以从 SageOne 访问我们的帐户数据?