-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cookie manager for flutter web #585
Comments
No, cookies are automatically managed by the browser |
Use flutter web to develop websites, and background services use golang, but cookies cannot always be set automatically when I request an interface. The headers returned by dio printing in flutter are only Content-Type and Content-Length, but in the browser developer mode, There is a Set-Cookie option in the Response header. The cookie-manager with the dio plug-in also has no effect. How to solve this situation? |
I solved this problem. BaseOptions options = new BaseOptions(
baseUrl: _baseUrl,
connectTimeout: 10000,
receiveTimeout: 5000,
headers: {
"Accept": "application/json",
},
);
DioForBrowser _d = DioForBrowser(options);
var adapter = BrowserHttpClientAdapter();
// This property will automatically set cookies
adapter.withCredentials = true;
_d.httpClientAdapter = adapter;
_d.get("http://localhost:1234/login...") |
My original comment was it did not work but i was mistaken. It does. the thing is, withCredentials is required in order for cookies to be written to browser. Shouldnt the default dio object have this property? instead of having to use DioForBrowser? |
Hello, I performed this procedure but flutter continues to print as content-type headers only: Thanks in advance |
I'm still not able to see the cookie in chrome tab
I'm facing the same issue. I set the withCredentials to true, but I'm still not able to see the cookies in the chrome dev tab. |
Do you plan for support Cookie manager in web?
The text was updated successfully, but these errors were encountered: