Gopal
Gopal

Reputation: 111

how to connect linkedin from node js. Or how to get access token from node js

Here is my code. Now IN.API.Profile("me") function not working. They return 404 error with message like "v1 was deprecated". So anyone can help me. Thanks in advance.!!

IN.User.authorize(() => {
    if (IN.User.isAuthorized()) {

        IN.API.Profile("me").fields([
            "id", "first-name", "last-name", "headline", "positions", "location",
            "num-connections", "emailAddress", "publicProfileUrl", "picture-urls::(original)",
            "publications", "languages", "skills", "certifications", "educations", "volunteer",
            "recommendations-received","date-of-birth",
        ]).result((data) => {
            console.warn(data);
        }); 
    }
});

Upvotes: 1

Views: 1165

Answers (1)

bato3
bato3

Reputation: 2815

What is incomprehensible is in the message: v1 was deprecated?

In end support for this api version. Update the library https://www.npmjs.com/package/node-linkedin-v2

//edit, sample code

let in = new LinkedInRestClient(...)
let access_token = await in.getAccessToken(...)
in.getCurrentMemberProfile(fields, access_token).then()

Or for user profile: use instruction and method getAuthorizationUrl to generate url, and then implement redirect_url route to store user access_token

Upvotes: 1

Related Questions