Discover more from Secaholic
Deal with challenge exceptions in Linkedin API
Calls from IP addresses that never logged in with the given account before will be blocked and required a verification.
Recently, I have to use Linkedin API to crawl companies in their ecosystem. The official API (v3)requires OAuth for authenticating and forces you to request to them before you can use the full version (public and private APIs). Luckily, I found that Linkedin offers Voyager API for searching and listing companies unofficially. It allows you to use your email and password for authenticating instead of OAuth tokens.
However, Linkedin seems to restrict calling to their APIs by checking the IP addresses. According to my observations, calls from IP addresses that never logged in with the given account before will be blocked and required a verification called the challenge exception. The only way to deal with this problem is logging in manually before calling API. However, in a non-UI environment like Linux-based production servers, you don’t have browsers and you’ll need a script to do that.
I have written such a script, you can find at my Github repository below