codestates / codestates/BanThing
[Error Handling] cookie 전달 에러
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
### 어떤 에러인가요?
- postman 에서는 쿠키가 전달되는게 확인됐지만

브라우저 상에서 쿠키가 전달되지 않습니다.


### 에러 핸들링 방법
- axios요청 보낼때 { withCredentials: true } 를 추가해주었습니다.
- 그리고 서버코드는 cors origin 을 "*" -> localhost 로 변경해줬습니다.
```
//Client
axios
.post(
`${process.env.NEXT_PUBLIC_SERVER_ENDPOINT}/users/login`,
{
user_id: userId,
password: password,
},
{ withCredentials: true },
)
//Server
app.enableCors({
origin: ['http://localhost:3000'],
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
credentials: true,
});
```
### 에러 핸들링을 위해 참고한 레퍼런스 링크
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.