dj-rest-auth icon indicating copy to clipboard operation
dj-rest-auth copied to clipboard

The cookies cannot be deleted on logout

Open borislav333 opened this issue 3 years ago • 7 comments

https://github.com/iMerica/dj-rest-auth/blob/8a460ecf9a72aec269b75160e5c97f7ed608e247/dj_rest_auth/jwt_auth.py#L60 https://github.com/iMerica/dj-rest-auth/blob/8a460ecf9a72aec269b75160e5c97f7ed608e247/dj_rest_auth/jwt_auth.py#L62

Please add samesite parameter to the delete_cookie function, because in Chrome for example the cookie cannot be deleted. When i add samesite='None' all is okay.

borislav333 avatar Apr 08 '21 22:04 borislav333

Is this a cross site scenario?

iMerica avatar Apr 10 '21 17:04 iMerica

Is this a cross site scenario?

That does seem likely. I wonder if any django-cors packages are able to supplement this issue with a low-effort patch.

dmgolembiowski avatar Apr 12 '21 00:04 dmgolembiowski

Has this been solved already?

roselleebarle04 avatar Apr 29 '21 22:04 roselleebarle04

I currently have the same problem.

However, this issue is not limited to Google Chrome for me as I have tested the /logout endpoint on Firefox and it doesn't work either.

I have tested the login and logout on Postman and it works perfectly :

  • Login : Cookies are set by the server image

  • Logout : Cookies are deleted without any issue image

  • The logout response headers image

Using my frontend app. :

  • Login : response headers > Cookies image

image

  • Logout : response headers > Cookies. Here the sessionid Cookie removal seems to be missing for unknown reasons (even though it is present in the Postman response) image

image

  • Checking the Cookies in the browser and they're still set with the initial expiration date image

image

I'm quite confused on what's happening here...

sadikuar avatar Sep 06 '21 08:09 sadikuar

Still not working... I have set all these settings:

CORS_ALLOW_CREDENTIALS = True
SESSION_COOKIE_SECURE = True
JWT_AUTH_SAMESITE = 'None'
JWT_AUTH_SECURE = True
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_SAMESITE = 'None'
SESSION_COOKIE_SAMESITE = 'None'

Works for some requests but definitely not for logout.

milano-slesarik avatar Feb 17 '22 20:02 milano-slesarik

Any new on this? I am facing the same issue. The Set-Cookie Header on the /logout is SameSite ="lax" but I've set cookies to None.

/login route comes back with SameSite=None and Secure, but logout doesnt even though its the same cookie its affecting and same header

DarnellSylvain avatar Oct 21 '22 17:10 DarnellSylvain

Same problem here.

ZunCreative avatar Feb 21 '23 15:02 ZunCreative