The Vault · Basic Auth

Real HTTP Basic Auth from a live backend: no credentials gets a 401 and a native prompt, which locators can't touch — pass credentials another way.

HTTP Basic Auth: the vault door is a browser prompt no locator can click.

Basic Auth is a medium Network & Auth challenge on Fun UI Playground. Real HTTP Basic Auth from a live backend: no credentials gets a 401 and a native prompt, which locators can't touch — pass credentials another way. It needs the site’s live backend for real HTTP behavior. Every interactive element carries a stable id and data-testid prefixed with “basic-auth-”, and the techniques it exercises are HTTP Basic Auth, credentials in URL, httpCredentials options, assert 401 vs 200.

At a glance

Category
Network & Auth
Difficulty
medium
Teaches
HTTP Basic Auth · credentials in URL · httpCredentials options · assert 401 vs 200
Backend
Needs the live /api backend
Locators
Stable id and data-testid, prefixed basic-auth-

Selectors on this page

LocatorWhat it is
h1#vault-openAuthenticated → 200 with a themed success page (h1#vault-open)

Frequently asked questions

How do I automate HTTP Basic Auth when the prompt is a browser dialog?

Don't try to click the prompt — no locator can reach it. Pass credentials through the driver instead: Playwright browser.newContext({ httpCredentials }), or a Selenium 4 CDP/BiDi auth handler. GET /api/basic-auth takes admin / secret and answers 200 with h1#vault-open.

Does the https://user:pass@host URL trick still work?

It still works here, but Chromium has been restricting embedded URL credentials, so prefer your driver's auth API. An unauthenticated request answers 401 with WWW-Authenticate: Basic realm="The Vault", which is the response worth asserting.

More Network & Auth

Updated

Fun UI Playground — all challenges, bug hunts, getting started, glossary, about.