Proxy Authentication with Puppeteer
Using an ip:port
proxy which doesn’t require an authentication is easy and you probably know that. All you need to do is pass a —- proxy-server
argument while calling the puppeteer.launch()
args: [`--proxy-server=${ip}:${port}`]
But when it comes to using a proxy with authentication like ip:port:user:pass
things getting complicated. The method above doesn’t work because it isn’t supported.
There is a simple workaround for this. I’m using Luminati -The biggest proxy service network- for all kind of proxy needs, mostly rotating proxies.
All we need to do is execute a page.authenticate
with our proxy credentials. Here is the result with my US proxy.
Don’t get confused with the line:12 since it’s not an essential part of this tutorial, here I used a random generated number to set it as a session id for Luminati. This is basically works as rotating proxy, it gives me a different IP address each time.
This is how I use a proxy authentication with Luminati. Feel free to post comments if you have any questions.