Shopee API访问令牌?



我是shopee 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"821 fbdc3e5f41d32884586c7f44be93a","error":"error_auth","message":"无效的access_token !"}

我怎么能得到access_token代码,它是在shopee管理页面或需要创建一个代码来获得?

您需要首先使用Shopee的auth_partner API从Shopee获得访问码。您可以参考如何从v2 Shop Authorization下的文档中获取访问令牌。在OpenAPI 2.0概述.

https://open.shopee.com/documents/v2/OpenAPI%202.0%20Overview?module=87& type = 2

最新更新