I want to pass session from passport.js to puppeteer.
I used var cookies = req.cookies;
in order to get the cookies value.
I console.logged it and it is something like this:
{ 'connect.sid': 's:qX4ZrttrjydtrjkgsdghsdghrewynZj4Ew2OUh.tTSILkcvgsegsegsegsr99gmW5
0XLcJefM' }
I thought that it would be as easy as to pass this value to puppeteer.
But puppeteer has a page.setCookie() function that its format is this:
page.setCookie(...cookies)
...cookies <...Object>
name <string> required
value <string> required
url <string>
domain <string>
path <string>
expires <number> Unix time in seconds.
httpOnly <boolean>
secure <boolean>
sameSite <string> "Strict" or "Lax".
returns: <Promise>
So how do i pass puppeteer my cookie? Is there a way to convert it from its raw value to the one that puppeteer accepts?
Maybe is that large string on my raw cookie, the value to pass to the object that puppeteer accepts?