i've tried to get a new token, by running shopee open api RefreshAccessToken with php curl, but the result always give me error param code.
from this documentation : https://open.shopee.com/documents/v2/OpenAPI%202.0%20Overview?module=87&type=2
<?php
$partner_id = ...partnerid;
$partner_key = ...partnerkey;
$timest = time();
$shop_id = ...shopid;
$refresh_token = ...refresh_token;
$host = 'https://partner.shopeemobile.com';
$path = '/api/v2/auth/access_token/get';
$base_string = sprintf("%s%s%s",$partner_id,$path,$timest);
$sign = hash_hmac('sha256', $base_string, $key, false);
$url = $host.$path.sprintf("?timestamp=%s&partner_id=%s&sign=%s",$timest,$partner_id,$sign);
$data = array(
'shop_id' => $shop_id,
'refresh_token:' => $refresh_token,
'partner_id:' => $partner_id,
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_POSTFIELDS => $data,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
// echo $response;
?>
and the result is
{"error":"error_param","message":"error params","request_id":"b61938142425d13e72292xf3b645d62b"}
where did my code goes wrong, please help.
your $sign is wrong.. should be