requests icon indicating copy to clipboard operation
requests copied to clipboard

I get the "Refused to set unsafe header "cookie"" error when I try from flutter web

Open mikeybellissimo opened this issue 2 years ago • 2 comments

Hi!

When I am using Flutter built on chrome and try to send a post request to my Express server to sign in, the cookie is not stored and the console reads the error : Refused to set unsafe header "cookie".

Here is the code that calls from the server side:

final response = await Requests.post("http://localhost:3000/signin", json: {"username": username, "password": password}, withCredentials: true);

response.raiseForStatus();

  • OS: Windows 10 Home
  • Chrome Version 106.0.5249.119

mikeybellissimo avatar Oct 22 '22 16:10 mikeybellissimo

Hi @mikeybellissimo, on web when an http request is done, it's the browser that handles the cookie. The error you get from the console shouldn't be an issue, it's just dart trying to set the cookie by itself though it's actually the browser that does that.

Is response.raiseForStatus(); stopping the app ?

sehnryr avatar Oct 24 '22 14:10 sehnryr

i have same isue. @mikeybellissimo

loczippo avatar Sep 12 '24 11:09 loczippo