缺少必要的参数,包括一个无效的参数值,参数不止一次与LinkedIn的API [英] Missing required parameters, includes an invalid parameter value, parameter more than once with LinkedIn API
问题描述
我试着用的OAuth2 LinkedIn的API进行身份验证。 code:
I try to authenticate with LinkedIn API with OAuth2. Code:
if ((isset($_GET["code"])) AND (isset($_GET["state"]))) {
$code = $_GET["code"];
$state = $_GET["state"];
$curl_request = curl_init();
curl_setopt_array($curl_request, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => "https://www.linkedin.com/uas/oauth2/accessToken",
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
grant_type => "authorization_code",
code => "$code",
redirect_uri => "SECRET",
client_id => "SECRET",
client_secret => "SECRET"
)
));
$curl_result = curl_exec($curl_request);
var_dump($curl_result);
}
我得到这个消息:
I got this message:
串(153){ERROR_DESCRIPTION:缺少必需的参数,
包括一个无效的参数值,参数不止一次。 :
CLIENT_ID,错误:INVALID_REQUEST}
string(153) "{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : client_id","error":"invalid_request"}"
您能帮毫升
推荐答案
您需要添加下面的头在你的卷曲POST调用,以确保您传递在您的文章正文中值间$ P $正确PTED
You need to add the following header in your cURL POST call to ensure that the values you are passing in the body of your POST are interpreted correctly:
内容类型:应用程序/ x-WWW的形式urlen codeD
Content-Type: application/x-www-form-urlencoded
有关更多信息,请参见 http://tools.ietf.org/html /rfc6749#section-4.1.3 实际的OAuth 2.0 RFC规范。
For additional info, see http://tools.ietf.org/html/rfc6749#section-4.1.3 for the actual OAuth 2.0 RFC spec.
这篇关于缺少必要的参数,包括一个无效的参数值,参数不止一次与LinkedIn的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!