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

99
Vistas
How to access Cookie in the Frontend?

I'm using React on the Frontend and NestJS on the backend.

I've created a JWT token which i've attached to a cookie, the cookie is being sent to the client after client successfully register with the DB.

Using Postman I can see the mentioned cookie but don't know how to access it in the frontend.

See code below, Please advice.

FrontEnd

const requestFormSubmition = async () : Promise<any> => {
    const response = await axios.post('http://localhost:3006/auth/login', {
        ...formData
    },
    {
        headers : {
            "Access-Control-Allow-Headers": "Accept"
        }
    })
    // const allResponse = response.headers;
    console.log(response);
}

Backend

return response.cookie("Autorization-token", data.access_token).json();

Cors options on the backend

  const app = await NestFactory.create(AppModule, { cors: {
    "origin": "*",
    "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
    "exposedHeaders" : "*",
    "allowedHeaders": "*",
  }
  });
  
  app.use(cookieParser());

Postman result

enter image description here

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