-
Notifications
You must be signed in to change notification settings - Fork 10k
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
HttpClient does not track cookies #16239
Comments
This just keeps getting better. I tried to use Reflection to hack a
Something is very wrong if this is trying to load |
Did you read the thread : aspnet/Blazor#357 ? |
@masonwheeler the HttpClientHandler is built on Sockets which aren't available in the browser 😈 |
@Suchiman |
@masonwheeler strangely enough when I query the |
Thanks for reporting this. Although it was possible to do before (via the So this is now fixed via dotnet/blazor#518. The new default behavior is to include cookies in same-origin requests. If you want, you can also change the default like this: https://github.com/aspnet/Blazor/blob/dev/test/testapps/BasicTestApp/Program.cs#L18 Note that setting a cookie container on |
Yeah, that does sound more useful. Thanks for fixing this up! |
Unfortunately, the link is dead, could you or someone please show what you meant(in code) instead of the link... |
It would be lovely if this was documented somewhere in the Blazor docs? It's just taken me two days to track down what was happening with my app and find this solution. Is not having a CORS web api that stores an authentication cookie fairly common in an SPA? https://docs.microsoft.com/en-gb/aspnet/core/blazor/call-web-api?view=aspnetcore-3.0 gets 90% of the way there near the end but doesn't quite nail it... Thanks |
If I
@inject
theHttpClient
and make a call to a server, it doesn't keep track of the cookies the server sends back. Normally, this is handled by a parameter passed to theHttpClient
's constructor, but with everything done via DI magic, this isn't happening in Blazor.It needs to happen, preferably by default. Is there any way to make it happen currently? If not, can this be fixed?
The text was updated successfully, but these errors were encountered: