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

103
Visualizações
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 à 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