Php linkedin oauth无效请求错误
我正在测试一个简单的oauth curl php脚本,但它不断返回此错误 回调url上的代码:Php linkedin oauth无效请求错误,php,curl,oauth,Php,Curl,Oauth,我正在测试一个简单的oauth curl php脚本,但它不断返回此错误 回调url上的代码: $code = $_GET['code']; $url = "https://www.linkedin.com/uas/oauth2/accessToken"; $redirect_uri = "http://127.0.0.1:8080/auth.php"; $api_key = "78v5tds9n6u10x"; $secret_key = "XXXXXXX"; $tokenArgume
$code = $_GET['code'];
$url = "https://www.linkedin.com/uas/oauth2/accessToken";
$redirect_uri = "http://127.0.0.1:8080/auth.php";
$api_key = "78v5tds9n6u10x";
$secret_key = "XXXXXXX";
$tokenArguments = array("grant_type" => "authorization_code",
"code" => $code,
"redirect_uri" => $redirect_uri,
"client_secret" => $secret_key,
"client_id" => $api_key);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $tokenArguments);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
在添加内容类型标题之前,我遇到了错误,即使在添加内容类型标题之后,我仍然会遇到相同的错误
{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : client_id","error":"invalid_request"}
试着这样做,我在创建SHA的过程中得到了我的解决方案
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
packageName, PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
// writtenToFile("FB_KEY_HASH.txt",
// Base64.encodeToString(md.digest(),
// Base64.DEFAULT).toString(), false);
if (AppUtills.showLogs)
Log.v(pageName,
"KeyHash:"
+ Base64.encodeToString(md.digest(),
Base64.DEFAULT));
}
} catch (Exception e) {
e.printStackTrace();
}
嘿@maximl337你解决这个问题了吗?