From 616bbc4d0938800abbc8f717abdc269d7b19de01 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 26 Aug 2026 15:14:57 +0100 Subject: [PATCH] docs(browsercontext): undeprecate setHTTPCredentials Note that browsers may cache credentials per origin instead. --- docs/src/api/class-browsercontext.md | 7 ++++++- packages/playwright-client/types/types.d.ts | 6 +++++- packages/playwright-core/types/types.d.ts | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md index 0859c935d4147..552cbe43d7331 100644 --- a/docs/src/api/class-browsercontext.md +++ b/docs/src/api/class-browsercontext.md @@ -1522,7 +1522,12 @@ its geolocation. ## async method: BrowserContext.setHTTPCredentials * since: v1.8 * langs: js -* deprecated: Browsers may cache credentials after successful authentication. Create a new browser context instead. + +Sets the credentials for HTTP authentication for this browser context. + +:::note +Browsers may cache credentials per origin after a successful authentication, so changing credentials for an origin that has already been authenticated may have no effect. +::: ### param: BrowserContext.setHTTPCredentials.httpCredentials * since: v1.8 diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts index 3a4630197a481..6de9373f54049 100644 --- a/packages/playwright-client/types/types.d.ts +++ b/packages/playwright-client/types/types.d.ts @@ -10602,7 +10602,11 @@ export interface BrowserContext { }): Promise; /** - * @deprecated Browsers may cache credentials after successful authentication. Create a new browser context instead. + * Sets the credentials for HTTP authentication for this browser context. + * + * **NOTE** Browsers may cache credentials per origin after a successful authentication, so changing credentials for + * an origin that has already been authenticated may have no effect. + * * @param httpCredentials Pass an array to use different credentials for different origins. The first entry that matches the request origin * is used, and entries with no origin match any request. */ diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 3a4630197a481..6de9373f54049 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -10602,7 +10602,11 @@ export interface BrowserContext { }): Promise; /** - * @deprecated Browsers may cache credentials after successful authentication. Create a new browser context instead. + * Sets the credentials for HTTP authentication for this browser context. + * + * **NOTE** Browsers may cache credentials per origin after a successful authentication, so changing credentials for + * an origin that has already been authenticated may have no effect. + * * @param httpCredentials Pass an array to use different credentials for different origins. The first entry that matches the request origin * is used, and entries with no origin match any request. */