LinkedIn API v2 未返回数据

LinkedIn API v2 not returning data

我在 linkedIn 上设置了一个应用程序。设置并测试代码以 return 访问令牌。一切都很好。我试图获取基本的配置文件数据,但它说我没有适当的访问权限。除了写帖子之外,我给了该应用程序所有基本权限,所以我不知道为什么什么都没有 returned。

错误:{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /me","status":403}

我的代码如下。THETOKENWOULDBEHERE 实时代码中的令牌是由 oauth 进程 return 编辑的。如果有人有任何见解,我们将不胜感激。

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.linkedin.com/v2/me");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-RestLi-Protocol-Version:2.0.0','x-li-format: json','Authorization: Bearer *THETOKENWOULDBEHERE*'));
$response = curl_exec($ch);
curl_close($ch);
print_r($response);

如果您使用的是 V2 并且您没有获得使用许可 r_basicprofile 然后要么向linkedin申请使用r_basicprofile的权限 或者使用 r_liteprofile + r_emailaddress

检查这个:https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context