How To Add Samesite=none In The Set_cookie Function Django?
I want to add samesite attribute as None in the set_cookie function This is the code where I call the set_cookie function redirect = HttpResponseRedirect( '/m/' ) redirect.set_cook
Solution 1:
You can use this library to change the flag if you're using django2.x or older: https://pypi.org/project/django-cookies-samesite/
If you're using django3.x, it should be built-in
Solution 2:
You can just use set_cookie('name', 'value')
on the HTTP response.
Like return HttpResponse("hi").set_cookie('name', 'Aniket')
Post a Comment for "How To Add Samesite=none In The Set_cookie Function Django?"