Garmin wellness api-无效的OAuth签名-PHP

Garmin wellness api-无效的OAuth签名-PHP,php,oauth-1.0a,garmin,Php,Oauth 1.0a,Garmin,我在向Garmin Wellness API生成oAuth签名时遇到问题 $oauth_nonce = 'OhJBVADBAC8'; $oauth_timestamp = '1614947339'; $date_from = 1607089161; $date_to = 1614865161; $url = 'https://apis.garmin.com/wellness-api/rest/backfill/activities?summaryStar

我在向Garmin Wellness API生成oAuth签名时遇到问题

    $oauth_nonce = 'OhJBVADBAC8';
    $oauth_timestamp = '1614947339';
    $date_from = 1607089161;
    $date_to = 1614865161;

    $url = 'https://apis.garmin.com/wellness-api/rest/backfill/activities?summaryStartTimeInSeconds=' . $date_from . '&summaryEndTimeInSeconds=' . $date_to;

    $base_string = 'GET&' . rawurlencode($url) . '&' . rawurlencode('oauth_consumer_key=' . $oauth_consumer_key . '&oauth_nonce=' . $oauth_nonce . '&oauth_signature_method=' . $oauth_signature_method . '&oauth_timestamp=' . $oauth_timestamp . '&oauth_token=' . $oauth_token . '&oauth_version=' . $oauth_version . '&summaryStartTimeInSeconds=' . $date_from . '&summaryEndTimeInSeconds=' . $date_to);

    $oauth_signature = hash_hmac("SHA1", $base_string, $oauth_consumer_secret, false);
    $oauth_signature = rawurlencode(base64_encode(pack('H*', $oauth_signature)));

    $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_CUSTOMREQUEST => 'GET',
        CURLOPT_HTTPHEADER => array(
            'Authorization: OAuth oauth_consumer_key="' . $oauth_consumer_key . '",oauth_token="' . $oauth_token . '",oauth_signature_method="' . $oauth_signature_method . '",oauth_timestamp="' . $oauth_timestamp . '",oauth_nonce="' . $oauth_nonce . '",oauth_version="' . $oauth_version . '",oauth_signature="' . $oauth_signature . '"'
        ),
    ));

    $response = curl_exec($curl);
    var_dump($response);
    curl_close($curl);
API返回“无效的OAuth签名”。当我放置Pastman生成的签名时,一切都正常,所以问题在于生成签名的方式

你能指出我的错误吗?

发布了一条谚语“按照此链接与Garmin连接,它起作用了。它使用相同的Auth1.0a身份验证过程”