본문 바로가기
개발 지식 A+/FE

how to show cookie headers at client

by ddubbu 2021. 1. 20.
728x90
반응형

마지막에 솔루션 있음

stackoverflow.com/questions/52549079/does-axios-support-set-cookie-is-it-possible-to-authenticate-through-axios-http

 

 

server 측에서는

app.use(cors({
  //! client cookie 정보를 가져오기 위해서 origin, credentials 설정 필요
  origin: "https://localhost:3000", // client domain 주소
  credentials: true, // client 에서 fetch, axios API 사용시 header 설정 예정
  methods: ['GET', 'POST', 'OPTION'],
}));

 

client 측에서는

const axios = require('axios');
axios.defaults.withCredentials=true; // 전체 API에 기본으로 설정해버리기
반응형

'개발 지식 A+ > FE' 카테고리의 다른 글

Hooks 공식문서로 이해하기  (0) 2021.01.26
this 키워드  (0) 2021.01.26
[반응형 웹] #1. 미디어 쿼리  (0) 2021.01.09
webpack 환경 설정  (0) 2021.01.09
React 공식문서 쉽게 공부하기  (0) 2021.01.02