Hi all, I'm having some trouble with my POST /logout route, seemingly because of Django's CSRF protections.
Here's what my route looks like:
permission_classes = [IsAuthenticated]
def post(self, request):
print('test')
django_logout(request)
return Response({})
and here's what my POST looks like:
const resp = await fetch('http://localhost:8000/auth/logout', {
method: 'POST',
credentials: 'include',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFTOKEN': csrfToken
},
body: JSON.stringify({})
});```
Here are my settings for good measure:
```CORS_ALLOWED_ORIGINS = ['http://localhost:3000']
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOW_HEADERS = ['Content-Type', 'X-CSRFTOKEN']
SESSION_COOKIE_SAMESITE = None
CSRF_COOKIE_SAMESITE = None
Any ideas?