Puppeeter / LinkedIn - Cookie expire issue

verbalk

Newbie
Joined
Jun 11, 2024
Messages
2
Reaction score
3
Hey guys - I've developed a LinkedIn automation tool, but I'm encountering an issue with Puppeteer.

Overview
  • We use Puppeteer to log users into LinkedIn with their credentials.
  • After logging in, we extract their cookies.
  • We then close the Puppeteer session and use these cookies for direct API calls to LinkedIn endpoints.

Issue
  • The cookies extracted via Puppeteer and used with node fetch to make api calls to linkedin work initially but expire after just 1 hour.
  • The same issue occurs when we manually extract cookies in incognito mode using Chrome.
  • However, when we manually extract cookies using a regular browser session (non-incognito in chrome), they function as expected and remain valid for an extended period (weeks).

What I need help with :
  • We need to configure Puppeteer to extract cookies that don't expire after 1 hour - or explore an alternative solution (selenium ?)
  • My theory is that LinkedIn detects the session as inauthentic, similar to how it treats incognito sessions. The solution might involve better fingerprinting, but I'm not entirely sure.
  • Understand wtf is going on and why the behavior of puppeteer and incognito session in regular browser is the same
Additional infos :
  • We already use puppeteer-extra-plugin-stealth


Paid: YES
Budget: TBD
Any guidance would be appreciated as well
 
Great. Coincidence I also working on similar project.
 
I have recently written a script in selenium-wire. This software will capture all the requests going between your browser and the target site. The script takes this list of requests, determines which is the request that returns the actual data of interest then simply repeats that request over and over with slightly different parameters to capture all of the data you want. The relevant cookie will somewhere in the request headers.

By all means, get in touch with me if you are interested in pursuing further.
 
Hi! Interested to have a talk on this, I am building something similar, happy to talk about it
 
You most likely get a temporary token (Access Token) that works only for 1 hour +-, it is used to work with the API. But you should also have a long token (Refresh Token), it is needed to request a temporary token. Some sites use protection to extract it, so that you cannot extract it using js. You need to find an opportunity to extract it, and submit a request to refresh the temporary token
 
Back
Top