我用的是Sandbox Auth。在这里,它总是给我带来这样的错误。
错误: Auth令牌无效。API请求中的身份验证令牌验证失败。
但如果我用8月制作的话。象征性的,它似乎是锻炼,没有任何问题。
我还检查了我的沙箱令牌的有效性,有效期是2016年11月,这已经足够远了。有人能帮我解决我的问题吗?提前谢谢。
下面是代码:
require __DIR__.'/../vendor/autoload.php';
$config = require __DIR__.'/../configuration.php';
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
$service = new Services\TradingService(array(
'apiVersion' => $config['tradingApiVersion'],
'siteId' => Constants\SiteIds::US
));
$request = new Types\GetMyeBaySellingRequestType();
$request->RequesterCredentials = new Types\CustomSecurityHeaderType();
$request->RequesterCredentials->eBayAuthToken = $config['sandbox']['userToken'];
$request->ActiveList = new Types\ItemListCustomizationType();
$request->ActiveList->Include = true;
$request->ActiveList->Pagination = new Types\PaginationType();
$request->ActiveList->Pagination->EntriesPerPage = 10;
$request->ActiveList->Sort = Enums\ItemSortTypeCodeType::C_CURRENT_PRICE_DESCENDING;
$pageNum = 1;
do {
$request->ActiveList->Pagination->PageNumber = $pageNum;
$response = $service->getMyeBaySelling($request);
echo "==================\nResults for page $pageNum\n==================\n";
if (isset($response->Errors)) {
foreach ($response->Errors as $error) {
printf("%s: %s\n%s\n\n",
$error->SeverityCode === Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning',
$error->ShortMessage,
$error->LongMessage
);
}
}
if ($response->Ack !== 'Failure' && isset($response->ActiveList)) {
foreach ($response->ActiveList->ItemArray->Item as $item) {
printf("(%s) %s: %s %.2f\n",
$item->ItemID,
$item->Title,
$item->SellingStatus->CurrentPrice->currencyID,
$item->SellingStatus->CurrentPrice->value
);
}
}
$pageNum += 1;
} while(isset($response->ActiveList) && $pageNum <= $response->ActiveList->PaginationResult->TotalNumberOfPages);戴维-萨德勒爵士
发布于 2015-05-18 12:36:27
默认情况下,SDK将连接到生产API。如果您想使用sandbox,那么在创建TradingService对象时,只需将true传递给sandbox配置选项即可。所有配置选项的列表都可用。
$service = new Services\TradingService(array(
'apiVersion' => $config['tradingApiVersion'],
'siteId' => Constants\SiteIds::US,
'sandbox' => true
));发布于 2015-05-18 04:59:39
基于我所提供的,我几乎可以保证你会把你的请求
https://api.ebay.com/ws/api.dll (这就是为什么生产自动化系统工作的原因)
而不是把它送到
https://api.sandbox.ebay.com/ws/api.dll ( sandox应该在其中工作)
附加说明
确保与生产相比,所有三个开发人员id都是沙箱,因为它们确实不同
另外应该注意的是,沙箱比生产有更多的bug,所以我个人只使用生产来设置我的调用和其他东西。
https://stackoverflow.com/questions/30295068
复制相似问题