Sous proxy / Integrations / Puppeteer

Proxy in Puppeteer with authentication

How to run Puppeteer through a proxy with login and password in two lines of code. At the end the script prints the IP the site sees.

HTTPHTTPSSOCKS5Login and passwordRotation and sticky
Puppeteer · proxy
--proxy-server=http://HOST:PORT
LOGIN
••••••
✓ IP: Germany, residentialRun

Why use a proxy in Puppeteer

Puppeteer is a Node.js library that drives Chrome or Firefox. The proxy address is passed to the browser with the --proxy-server flag at launch. Login and password are set separately with page.authenticate.

What to pick

Take an HTTP proxy: Chrome doesn't support SOCKS5 with a password, and page.authenticate works with HTTP auth. Rotation suits scraping; a sticky session suits flows with an account login.

Residential

from $0.6 / GB

Home ISP addresses. The main choice for accounts and protected sites.

VIP

$2 / GB

Hand-picked clean IPs, faster and more stable than regular residential.

Mobile

$4 / GB

Carrier IPs, for platforms that check addresses strictly.

Step-by-step setup

Button names are given exactly as they appear in Puppeteer.

  1. Install Puppeteer

    Run npm i puppeteer. The package downloads a compatible Chrome build itself.

  2. Export the proxy

    Take an HTTP proxy in @SousProxyBot or the dashboard. Host and port go into the launch flag, login and password into authenticate.

  3. Pass the proxy at launch

    In puppeteer.launch add args: ['--proxy-server=http://HOST:PORT']. Don't put the login in this flag.

  4. Authenticate on the page

    Right after browser.newPage() call page.authenticate({ username, password }), before the first page.goto.

  5. Run and check the IP

    Open https://api.ipify.org?format=json and print the page text. It should be the proxy IP.

Code example

Put in your own HOST, PORT, LOGIN and PASSWORD from the bot or the dashboard.

js
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({
  args: ['--proxy-server=http://HOST:PORT'],
});
const page = await browser.newPage();
await page.authenticate({ username: 'LOGIN', password: 'PASSWORD' });

await page.goto('https://api.ipify.org?format=json');
console.log(await page.evaluate(() => document.body.innerText));

await browser.close();

Tested by running it

We ran this example ourselves: Node.js 22.23.5 · puppeteer 25.18.1 · Chrome for Testing 153.0.8010.12. Real output below, IP hidden.

Terminal · ip.mjs
$ node ip.mjs
{"ip":"proxy IP"}

And this is the response when the password is wrong:

$ node ip.mjs
…
If the problem continues, contact the site owner.

HTTP ERROR 407
Reload

Common errors

The issues people most often bring to support.

!

net::ERR_INVALID_AUTH_CREDENTIALS or a 407 responseCheck the login and password and that page.authenticate is called before goto. It's needed on every new page.

!

net::ERR_NO_SUPPORTED_PROXIES with socks5:// and a loginChrome doesn't support SOCKS5 with auth. Use an HTTP proxy.

!

A new tab opens without proxy authauthenticate is bound to a page. Call it again for every browser.newPage().

!

SyntaxError on await outside a functionSave the file as .mjs or add "type": "module" to package.json. Or wrap the code in an async function.

Need a proxy for Puppeteer?

Residential, VIP and mobile IPs. HTTP and SOCKS5, pay per GB, 1 GB free to try.

FAQ

Can I put the login right into --proxy-server?

No, Chrome ignores login and password in this flag. They are passed only through page.authenticate.

How do I give different pages different proxies?

--proxy-server applies to the whole browser. For different IPs it's easier to run separate browser instances or use sticky sessions with different parameters from the dashboard.

Where do I check for a WebRTC leak?

Open /en/tools/webrtc-leak/ through the same proxy. If your real IP shows, disable WebRTC in the browser.