Search code examples
javascriptlinkedin-api

Javascript LinkedIn API read-only on a specific user


I'm trying to get read-only public information from my LinkedIn profile through the javascript API. I currently have this code, which I know is incomplete:

<script>
    function linkedinAuthorized() {
        console.log("Linked in authorized");
    }

    function linkedinLoaded() {
        console.log("Linked in loaded");

        IN.Event.on(IN, "auth", linkedinAuthorized);

        var url = "/people/~?format=json";

        IN.API.Raw()
            .url(url)
            .method("GET")
            .result(function (result) {
                console.log(result);
            })
            .error(function (error) {
                console.log(error);
            });
    }
</script>
<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key:   [my key]
    onLoad:    linkedinLoaded
</script>

I am able to load the linked in successfully, but when perform the IN.API.Raw call I get:

enter image description here
which I suspect is because I have not logged into an account with one of those LinkedIn login buttons.

My question is if can I get read-only profile information from a specific user without going through one of those manual authorization processes?


Solution

  • Might this be linked to this answer ?

    My question is if can I get read-only profile information from a specific user without going through one of those manual authorization processes?

    The answer is no. LinkedIn use OAuth 2.0, even the tool they provide can't perform the request https://api.linkedin.com/v1/people/~?format=json.

    You need to get the user logged-in to perform such actions !