Django With ReactJs
Solving CSRF issue on React With Django (Running on Django Server)
npm install js-cookie --save
import Cookies from 'js-cookie'
const csrftoken = Cookies.get('csrftoken') // Cookies from Django Domain
const loginRequest = async () => {
await Axios({
method: "post",
url: `/api/api-auth/login/`,
headers: { 'X-CSRFToken': csrftoken },
data: {}
}).then((res) => {
console.log(res.data);
})
}
Fetch CSRF Token from Django Server:
django.middleware.csrf.get_token(request)
Send emails with Django and Gmail , a better way :
https://dev.to/abderrahmanemustapha/how-to-send-email-with-django-and-gmail-in-production-the-right-way-24ab
Comments
Post a Comment