我有我的代码,如下所示。我正在尝试使用 eBay 对用户进行身份验证,以便能够获取访问令牌。在将用户重定向回我的重定向 URL 以与访问令牌交换代码时,我收到错误消息:
HTTP/1.1 100 继续 HTTP/1.1 400 错误请求内容-长度:109 连接:关闭日期:2017 年 3 月 2 日星期四 06:47:51 GMT RlogId:t6ldssk%28ciudbq%60anng%7Fu2h%3F%3Cwqn*2 3D%3F%3E505-15a8dc659e6-0xf3 Set-Cookie: ebay=%5Esbf%3D%23%5E;Domain=.ebay.com;Path=/ X-EBAY-C-REQUEST-ID: ri=v22kQg9yaBLq,rci= 2FDyansIYnkONQC X-EBAY-C-VERSION: 1.0.0 X-EBAY-REQUEST-ID: 15a8dc658f8.a0968eb.5f6ef.fff87b7e![] Content-Type: application/json Connection: keep-alive {"error":"invalid_request ,"error_description":"'Authorization' 缺少标题:","error_uri":null}
我的 POST 请求有什么问题?
$auth_code = $_GET['code'];
$client_id = "Client ID";
$client_secret = "Client Secret";
$redirect_uri = "RuName";
$headers = array (
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => sprintf('Basic %s',base64_encode(sprintf('%s:%s', $client_id, $client_secret)))
);
$apiURL = "https://api.sandbox.ebay.com/identity/v1/oauth2/token";
$urlParams = array (
"grant_type" => "authorization_code",
"code" => …Run Code Online (Sandbox Code Playgroud)