1

I've been trying to understand why my browser does not set the cookies I'm getting from my login api for the last 4 hours and I'm losing my mind, pls help. My frontend is a create-react-app on localhost:8888 and my api is a django rest framework on localhost:8000. I'm using fetch() for all the communication to the api

Comments
  • 1
    this is my function sending the username and password to the endpoint, I even get a 200 OK response and the cookies, but my browser ignores them
  • 1
    I don't know why my first image did not upload with the post but here it is
  • 1
    Are you on Chrome in incognito mode?
  • 1
    @neeno mmmm I haven't tried that. I use Brave
  • 2
    @juanchdzl nonono, I meant to say that it could be the problem. Chrome blocks cookies on incognito. Actually I'm not sure about that anymore, whatever don't trust me lol
  • 1
    @neeno Yeah I just tried that and same problem. I don't know what to do now. I tried setting the cookie for the domain I host my frontend but that doesn't work either
  • 1
    ok I just fixed it. Time to celebrate
  • 0
    @juanchdzl
    Was the fix CORS-related?
  • 2
    @neeno It doesn't block cookies, it just creates a new context without any cookies from the main session. Otherwise, logging in to most sites wouldn't work.
  • 1
    @junon yeah, that's exactly what I was thinking. Does it block 3rd party cookies? I remember having issues with incognito on a project I was doing that had google authentication and I'm pretty sure it had something to do with cookies...
  • 2
    @Oktokolo Yes I had to add a setting on my cors package to allow credentials in my server
Add Comment