I'm logged in to the web page, navigate to the destination web page with puppeteer/playwright and want to download a csv file with request.
The request headers include Authorization: "Bearer eyJ0eXAiOiJKV......"
is it possible to get Authorization: "Bearer Token" from puppeteer/playwright and submit it to request (eg axios).
Thnx a lot
I found solution:
var accessTokenObj = await crPage.evaluate(() => {
return localStorage.getItem("TokenName");
});
an then put accessTokenObj into axios header
Authorization: Bearer ${accessTokenObj}
Since I couldn't find crPage,I used page from playwright to get authorization token.
var token = page.evaluate(localStorage.getItem("access_token")); playwright docs ! for page.evaluate()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With