Bad Request Your browser sent a request that this server could not understand

  • 3,000
  • Tác giả: admin
  • Ngày đăng:
  • Lượt xem: 3
  • Tình trạng: Còn hàng

I am trying to tướng make get an oauth acces token from magento but when i sent the data i receive this error.

Bad Request Your browser sent a request that this server could not understand

This is the header of the request lặng sending.

"Authorization":"OAuth oauth_consumer_key=\"blank for privacy reasons\", oauth_callback=\"blank for privacy reasons\", oauth_nonce=\"2hf5FfiJplHLFBslkDbJBX4xnebUUTZw\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1667573144\", oauth_version=\"1.0\", oauth_signature=\"PJPiRYAIZG2cnkBTmfMuexzw%2BGc%3D\"","Accept-Encoding":"deflate, gzip","Accept":"*\/*","Content-Length":"0","Host":"magento-control-panel.test","Content-Type":""}

the request goes to tướng /oauth/token/request. I sent the data using Curl.


    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 => 'POST',
        CURLOPT_HTTPHEADER => array(
            'Authorization: ' . $data["Authorization"],
            'Content-type: ' . $data["Content-type"],
            'Host: ' . $data["Host"]          
        ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);
    echo $response;

I dont know what i did wrong. If you know a way to tướng fix it please let bu know, Thanks!!