I used Django 2.0.2 version. I tried to process google authentication in Django project. I got the token but I will pass URL and token. it return 404 error. I need to add samesite='none' in Django settings project. Where to add I don't know and I tried to add many ways but still it's throwing 404 error. How to fix it.
Settings.py
MIDDLEWARE = [
'django_cookies_samesite.middleware.CookiesSameSite',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
So, I added samesite.middleware.CookiesSameSite middleware. but still I facing this warning A cookie associated with a cross-site resource at http://stats.XXXX.com/ was set without the SameSite
attribute. It has been blocked, as Chrome now only delivers cookies with cross-site requests if they are set with SameSite=None
and Secure
. You can review cookies in developer tools under Application>Storage>Cookies and see more details How to fix it
Copyright Notice:Content Author:「Hariprasath Vengatachalam」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/63573949/how-to-add-samesite-none-option-in-django-settings-file