GuidesIntegrations

Puppeteer

Launch Chrome through the gateway and authenticate each page.

Pass the gateway as a launch argument, then authenticate on each page:

JavaScript
import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  args: ["--proxy-server=http://gate.riftip.com:7777"],
});

const page = await browser.newPage();
await page.authenticate({
  username: `${process.env.RIFTIP_USER}-net-residential-country-gb`,
  password: process.env.RIFTIP_PASS,
});

await page.goto("https://ip.riftip.com");
console.log(await page.$eval("body", (el) => el.textContent));
await browser.close();

#Changing identity between pages

Because options live in the username, each page can authenticate with different options — a different country or session — while sharing one browser.

JavaScript
await page.authenticate({
  username: `${process.env.RIFTIP_USER}-session-run_${Date.now()}-ttl-15m`,
  password: process.env.RIFTIP_PASS,
});

Note

Chrome caches proxy credentials per browser. To switch options reliably, open a new incognito context with browser.createBrowserContext() and authenticate there.