codestates / codestates/memory.json

[Error] server에서 client로 쿠키 내용 전송이 안되는 문제

Open
#109 0 comments 0 reactions 0 assignees View on GitHub
error
Dominant language
JavaScript
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### 어떤 에러인가요?
액세스 토큰을 쿠키에 담아 보내려고 하는데 클라이언트에 저장이 안되는 문제

### 에러 메시지

![스크린샷, 2022-05-03 16-01-55](https://user-images.githubusercontent.com/93461412/166415450-9a149dba-7920-4d3b-8455-32a779326e21.png)

### 에러 핸들링 방법
* 핸들링 방법 기록
```
서버는 pem 키 파일이 있어 https로 동작했고 클라이언트는 리액트 http로 동작되었다.

구글 크롬에서 http와 https 프로토콜의 통신간을 same-site로 간주할것인가에 대한 문제였다..
결론적으로는 이제 http와 https 통신은 same-site가 아니다. 따라서 cross-site로 간주하며
쿠키에서 same-site 속성을 주지 않으면 lax값이 기본이기 때문에 서버에 데이터를 바꾸지 않는 get요청에서만
쿠키를 보낼 수 있다.

그러나 우리는 accessToken을 post요청으로 보내야 하기 띠문에 문제가 생긴다.
same-site 속성을 none으로 주면 되지 않느냐 하지만 same-site 속성을 none으로 주면 secure 옵션을 true로 해줘야(https only)
되기 떄문에 지금으로써는 그게 그거이다.

```

### 레퍼런스
[https://blog.jaysiyo.com/2021/schemeful-same-site/](https://blog.jaysiyo.com/2021/schemeful-same-site/)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.