Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda