Hyebin‘s blog
Published 2022. 7. 30. 22:28
withCredentials 옵션 Other

프론트 서버와 백엔드 서버의 도메인이 다를 경우 백엔드에서 프론트엔드로 쿠키를 생성시켜 줄 수 없고, 프론트에서 백엔드로 쿠키를 보낼 수 도 없다. 이 문제를 해결 하기 위해 withCredentials : true 로 설정한다.

 

axios.post(`${EndPoint.APIServer}/login/`, { 
    profile: { username: username, password: password } 
}, { 
	withCredentials: true // 쿠키 cors 통신 설정
})
.then(response => { 
    console.log(response); 
    console.log(response.data); 
})

 

 

'Other' 카테고리의 다른 글

[GraphQL]  (0) 2023.01.11
profile

Hyebin‘s blog

@hyebin Lee

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!

검색 태그