Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

156
Vistas
Unable to delete a cookie that is HttpOnly using an external library

I am trying to delete a cookie using the js-cookie library.

Note that this cookie is not created by me. Is by another team and
can't be changing this cookie in any manner.

But the cookie remains even after attempting to delete.

Could I please know what I am doing wrong?

These are the details of the cookie.

name: my_cookie
value: uligasdf67gdjfkb
Domain: .mycompany.com 
Path: /
Expires / Max-Age: 2021-09-15T21:39:37:757Z  
Size  59 
HttpOnly: Has a tick which I believe indicates yes. 
SameSite: Lax 
SameParty: (Empty)
Priority: Medium 

This cookie is set to expire in 10 minutes after being set but depending on certain logic, I want to just delete it before the expiry.

This is how I am trying to delete it which no effect, cookie not deleted.

Using js-cookie package.

Importing in my package.json file

"dependencies": {
  "js-cookie": "^2.2.0"
},

Logic to delete.

import Cookies from 'js-cookie';
Cookies.remove('my_cookie', { path: '/', domain: '.mycompany.com' });

Is there a way around this to delete it?

Edit:

Tried what is suggested in this page to set cookie with empty value to essentially delete cookie.

Cookies.set('my_cookie', '');

But I end up with 2 cookies. The difference being the domain.

The existing cookie which is still not deleted.

name       value          domain
my_cookie  asdfasdfasfd   .mycompany.com

Cookie getting duplicated instead of overriding

name       value          domain
my_cookie                 qwww.mycompany.com
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda