linkedin-private-api icon indicating copy to clipboard operation
linkedin-private-api copied to clipboard

calling `sendInvitations()` always results in a `403` status and a security challenge

Open pkchv opened this issue 2 years ago • 1 comments

I'm trying to send an automated invite via sendInvitation() method, but this always results in a 403 response from LinkedIn API with a security challenge link.

I'll add that the login method works fine, also I can call Search People API, which works, but data is partly anonymized (user public identifier and profile link are set to UNKNOWN values, profile.fistName and profile.lastName are set to empty strings).

I'm wondering if anyone encountered similar issues?

Library version: v1.1.1 Node version: v14.17.6

Steps to reproduce:

import { Client } from "linkedin-private-api";

const username = process.env.USERNAME as string;
const password = process.env.PASSWORD as string;
const profileId = process.env.PROFILE_ID as string;
const trackingId = process.env.TRACKING_ID as string;

async function main() {
  try {
    const client = new Client();
    await client.login.userPass({
      username,
      password,
    });

    await client.invitation.sendInvitation({
      profileId,
      trackingId,
    });
  } catch (err) {
    console.log(err.response.data);
  }
}

main();

pkchv avatar Apr 15 '22 17:04 pkchv

Does this still happen if you try to send those invites from another LinkedIn account?

eilonmore avatar Apr 28 '22 12:04 eilonmore