tough-cookie.cookiejar.removeallcookies.md

July 9, 2025 ยท View on GitHub

Home > tough-cookie > CookieJar > removeAllCookies

CookieJar.removeAllCookies() method

Removes all cookies from the CookieJar.

Signature:

removeAllCookies(callback: ErrorCallback): void;

Parameters

Parameter

Type

Description

callback

ErrorCallback

A function to call when all the cookies have been removed.

Returns:

void

Remarks

  • This is a new backwards-compatible feature of tough-cookie version 2.5, so not all Stores will implement it efficiently. For Stores that do not implement removeAllCookies, the fallback is to call removeCookie after getAllCookies.

  • If getAllCookies fails or isn't implemented in the Store, an error is returned.

  • If one or more of the removeCookie calls fail, only the first error is returned.