-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Feature Request
I'd like to connect to a browserWSEndpoint that is protected by authentication. It would be nice to be able to provide an Authorization Bearer <token> on the connection, and every request thereafter to that endpoint.
I'm specifically wanting the Authorization Header, but this probably could just be generic to allowing any headers on all requests.
I vision within the connect options, provide a headers option
https://github.com/puppeteer/puppeteer/blob/v9.1.1/docs/api.md#puppeteerconnectoptions
Example:
browser = await puppeteer.connect({
browserWSEndpoint: "ws://my.server",
headers: {
Authorization: "Bearer hunter2"
},
});
I'd imagine the change would happen here:
| const ws = new WebSocket(url); |
To be something similar to:
websockets/ws#473 (comment)
I did see page.setExtraHTTPHeaders(headers), but I don't think this what I'm looking for as it shouldn't just be for a specific page, but for all websocket requests to the server.
https://github.com/puppeteer/puppeteer/blob/v9.1.1/docs/api.md#pagesetextrahttpheadersheaders