简体   繁体   中英

LinkedIn Works with LinkedIn's testDevCo not with wanted company page

I have a problem fetching company updates, but my code works fine with the following Linkedin testDevCo "var cpnyID = 2414183; //LinkedIn's testDevCo

So My question is that I am an admin to the company that I want to fetch the updates i from, but why do I get the following error ?

{
  "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)
  • I am an admin, I can see the company under the "MANAGE" section. But I don't have the company as my current position in my profile.
  • "check if you are sending the right request" => how do I do it ?

couple of things you can do/check:

  • show us your code
  • show us your application permissions
  • check if you are an administrator of the company page and the application
  • check if you have the correct companyID
  • check if you are sending the right request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM