【问题标题】:LinkedIn Works with LinkedIn's testDevCo not with wanted company pageLinkedIn 与 LinkedIn 的 testDevCo 一起使用,而不是与想要的公司页面一起使用
【发布时间】:2018-11-02 22:38:28
【问题描述】:

我在获取公司更新时遇到问题,但我的代码在 以下LinkedIn testDevCo "var cpnyID = 2414183; //LinkedIn 的testDevCo

所以我的问题是我是我想要获取的公司的管理员 我的更新,但为什么会出现以下错误?

{
  "errorCode": 0,
  "message": "Unknown authentication scheme",
  "requestId": "MRJ33C5FVX",
  "status": 401,
  "timestamp": 1540989274268
}

Code: 

<script type="text/javascript" src="https://platform.linkedin.com/in.js">
api_key: 8616po0krrhh2k
 onLoad: onLinkedInLoad, onLinkedInAuth
</script>


   <div id="displayUpdates"></div>
<script type="text/javascript">

    function onLinkedInLoad() {
        IN.Event.on(IN, "auth", onLinkedInAuth);
        console.log("On auth");
    }

    function onLinkedInAuth() {
        var cpnyID = 86104; //the Company ID for which we want updates
        IN.API.Raw("/companies/" + cpnyID + "/updates?event-type=status-update&start=0&count=3&format=json").method("Get").result(displayCompanyUpdates)
        console.log("After auth");
    }

    function displayCompanyUpdates(result) {
        var div = document.getElementById("displayUpdates");
        var el = "<ul>";
        var resValues = result.values;
        for (var i in resValues) {
            var share = resValues[i].updateContent.companyStatusUpdate.share;
            var isContent = share.content;
            var isTitled = isContent,
                isLinked = isContent,
                isDescription = isContent,
                isThumbnail = isContent,
                isComment = isContent;
            if (isTitled) {
                var title = isContent.title;
            } else {
                var title = "News headline";
            }
            var comment = share.comment;
            if (isLinked) {
                var link = isContent.shortenedUrl;
            } else {
                var link = "#";
            }
            if (isDescription) {
                var description = isContent.description;
            } else {
                var description = "No description";
            }
            /*
            if (isThumbnailz) {
            var thumbnailUrl = isContent.thumbnailUrl;
            } else {
            var thumbnailUrl = "http://placehold.it/60x60";
            }
            */
            if (share) {
                var content = "<a target='_blank' href=" + link + ">" + comment + "</a><br>";
                //el += "<li><img src='" + thumbnailUrl + "' alt=''>" + content + "</li>";
                el += "<li><div>" + content + "</div></li>";
            }
            console.log(share);
        }
        el += "</ul>";
        document.getElementById("displayUpdates").innerHTML = el;
    }
</script>
  • Premission:(r_basicprofile, r_emailaddress, rw_company_admin, w_share)
  • 我是管理员,我可以在“管理”部分看到公司。但我不 在我的个人资料中将公司作为我目前的职位。
  • “检查您是否发送了正确的请求” => 我该怎么做?

【问题讨论】:

    标签: javascript linkedin linkedin-api linkedin-jsapi


    【解决方案1】:

    您可以做/检查的几件事:

    • 向我们展示您的代码
    • 向我们展示您的应用权限
    • 检查您是否是公司页面和应用程序的管理员
    • 检查您的公司 ID 是否正确
    • 检查您是否发送了正确的请求。

    【讨论】:

    • 请从您的按钮中删除范围。
    • 你在onload后面还有一个逗号可以去掉
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 2021-04-13
    相关资源
    最近更新 更多