我是商店API中的新手,我只是想知道如何找到访问令牌?
$host = '*****';
$date = new DateTime();
$timestamp = $date->getTimestamp();
$partner_id = ****;
$shop_id = ****;
$secret_key = "**********";
$path = "/api/v2/product/get_item_list"; //without the host
$base_str = $partner_id . $path . $timestamp . $shop_id;
$sign = hash_hmac('sha256', $base_str, $secret_key, false);
$sign = bin2hex($sign);
$response = Http::withHeaders([
//'X-First' => 'foo',
//'X-Second' => 'bar'
])->get('https://partner.test-stable.shopeemobile.com/api/v2/product/get_item_list', [
'partner_id'=>$partner_id,
'timestamp'=>$timestamp,
'access_token'=>$sign,
'shop_id'=>$shop_id,
'sign'=>$sign
]);
return $response; 错误是:{"request_id":"821fbdc3e5f41d32884586c7f44be93a"," error ":"error_auth",“message”:“无效access_token”}。
如何获得access_token代码,是在商店管理页面中,还是需要创建代码才能得到?
发布于 2022-06-01 02:22:34
您需要首先使用auth_partner API从Shopee获取访问代码。您可以在v2 Shop授权下的OpenAPI 2.0概述中参考如何从它们的文档中获取访问令牌。
https://open.shopee.com/documents/v2/OpenAPI%202.0%20Overview?module=87&type=2
https://stackoverflow.com/questions/72430568
复制相似问题