Reputation: 386
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
Upvotes: 4
Views: 8212
Reputation: 71
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()
Upvotes: 1
Reputation: 386
I found solution:
var accessTokenObj = await crPage.evaluate(() => {
return localStorage.getItem("TokenName");
});
an then put accessTokenObj into axios header
Authorization: Bearer ${accessTokenObj}
Upvotes: 7