尝试使用 LinkedIn API 对用户进行身份验证时,我遇到了这个奇怪的错误。数据的 var_dump() 显示了这一点:
string(156) "{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : ssl required","error":"invalid_request"}"
我不确定为什么会发生这种情况,任何人都可以帮助我解决这个问题。
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.linkedin.com/uas/oauth2/accessToken?");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded',
));
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'grant_type' => 'authorization_code',
'client_id' => $account['linkedin']['api_key'],
'client_secret' => $account['linkedin']['api_secret'],
'code' => $_GET['code'],
'redirect_uri' => get_admin_url() . 'admin.php?page=' . self::$accounts_dashboard_page . '&linkedin=authorization&account=' . urlencode($account['id']),
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);