swsnu / swppfall2019

31 stars 23 forks source link

Signup, Signin 의 경우 @csrf_exempt 사용 여부에 관한 질문 #154

Open tyj9327 opened 4 years ago

tyj9327 commented 4 years ago

안녕하세요

과제에서 Signup testcode 예시를 보면 Signup을 하기 위해서도 토큰을 받아와서 진행하도록 되어있습니다. 그런데 실제 프론트와 연결되었을 경우를 생각해보면 토큰은 Signin을 하고 나면 발급이 되기 때문에 Signup과 Signin API를 호출하기 위해서도 토큰을 필요로 하는 것이 약간 어색하게 느껴집니다. Signup 테스트코드에서 제시되어있듯 Signin API 역시 @csrf_exempt 데코레이터 없이 구현하고 매번 api/token/을 통해 토큰을 가져와서 테스트코드를 짜면 될까요?


In Signup test code, previously it receives token by api/token/ and use it to call api/signup. Do we also have to emit @csrf_exempt decorator on Signin api and implement the test code similarly? Or can we just add @csrf_exempt decorator which seems more natural when Frontend is connected.

kyunggeunlee commented 4 years ago

네 맞습니다. CSRF 토큰은 로그인 여부와는 독립적으로 동작하기 때문에, csrf_exempt 데코레이터 없이 구현하셔야 합니다.