When I am trying to post data using my dj-rest-auth api
http://localhost:8000/dj-rest-auth/login/
it gives this error CSRF Failed: CSRF token missing.
How do I fix this as I am unable to find the CSRF value to put into headers. Where can I actually find this value.
This is my settings for dj-rest-auth in views.py
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
'dj_rest_auth.jwt_auth.JWTCookieAuthentication',
),
}
REST_AUTH = {
'USE_JWT': True,
'JWT_AUTH_COOKIE': 'jwt-auth',
}
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
SITE_ID = 1
ACCOUNT_EMAIL_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_VERIFICATION = 'optional'
AUTHENTICATION_BACKENDS = [
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by email
'allauth.account.auth_backends.AuthenticationBackend',
]
Tried sending a get request to this api but the method isn't allowed Tried putting the csrf value of localhost:8000 in my headers which I got from mozilla firefox in the storage/cookies section. But it said the csrf value is incorrect.