October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Puppeteer Credentials: Set HTTP Authentication Credentials

Set HTTP authentication in Puppeteer by awaiting page.authenticate({ username, password }) before navigating to the protected resource.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call await page.authenticate({ username, password }) before navigating to a page protected by HTTP authentication. The method configures credentials for that Puppeteer Page; it does not fill in an ordinary website login form.

Set HTTP authentication credentials before navigation

Page.authenticate() accepts a credentials object with string properties named username and password. Await the call before navigating to the protected URL:

const { browser } = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();

    await page.authenticate({
      username: 'user',
      password: 'pass',
    });

    await page.goto('https://example.com/protected');
    // Continue with page inspection or other work here.
  } finally {
    await browser.close();
  }
})();

Replace the example credentials and URL with your own. This is the documented API shape; it does not establish that those example credentials work against a live site. The method returns a Promise<void>, so use await to complete the setup before continuing.

What this method handles—and what it does not

HTTP authentication challenges

Puppeteer documents Page.authenticate(credentials) as providing credentials for HTTP authentication. It is a Page-level setting, not a browser-wide configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HTML login forms

A web page that displays username and password fields in its HTML is an application login form, not necessarily an HTTP authentication challenge. The API documentation does not establish that page.authenticate() fills or submits such a form. For a form-based flow, interact with the page’s form controls using the application’s documented login process instead.

Performance and request interception

Puppeteer’s Page API documentation says request interception is enabled behind the scenes to implement authentication and warns that this might affect performance. It does not quantify the impact, so there is no documented amount to apply as a general estimate. If performance matters, measure your own workload with and without authentication rather than assuming a specific slowdown.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Proxy authentication and separate credentials

page.authenticate() can be used for HTTP authentication challenges, including proxy authentication. A supplementary Puppeteer guide notes a limitation: one call cannot express different credential pairs for a proxy challenge and a website challenge at the same time. Its suggested architecture is to have a local proxy handle upstream proxy credentials, leaving page.authenticate() available for website authentication. This is practitioner guidance, not an official Puppeteer guarantee.

Disable authentication

Pass null to turn off authentication for the Page:

await page.authenticate(null);

Troubleshooting

  • The protected page still rejects access: Confirm that the server is issuing an HTTP authentication challenge and that the username and password are correct. This method does not establish a session by filling an HTML login form.
  • The page navigates before authentication is configured: Await page.authenticate(...) before calling page.goto() on the protected resource.
  • Proxy and site credentials conflict: One credentials pair cannot represent separate credentials for both challenges. Consider handling upstream proxy authentication in a local proxy, as described in the supplementary guide.
  • Performance changes after enabling authentication: Request interception is part of the documented implementation and may affect performance, but Puppeteer publishes no measurement for the impact. Compare timings in the environment and workload that matter to you.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For capturing a page as an image, ScreenshotNeo offers a one-request screenshot API. It is a screenshot service, not a replacement for Puppeteer’s HTTP authentication setup; the example below does not pass HTTP-auth credentials.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

See the ScreenshotNeo API documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/protected -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Its MCP server provides screenshot tools for AI agents, and its free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. See ScreenshotNeo for service details.

Sign up for 1,000 free screenshots a month with no card.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.