Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have an API endpoint mapped to handle a Logout request.
In my client component, when I try to make a request to this endpoint I get the error:
I tried making this work by following the documentation example at https://learn.microsoft.com/en-us/aspnet/core/blazor/call-web-api?view=aspnetcore-8.0#antiforgery-support but failed.
First, because the documentation example is outdated. The AntiforgeryRequestToken has no RequestToken field.
I tried making it work using the GetAndStoreTokens call, which seems to be the up to date API for this.
However when the request is posted, the same error says again:
As far as I can tell, the cookie is not being set in the HttpClient headers properly. I do set the token, but the cookie is missing.
I have tried setting the header to different names but nothing has worked so far.
The use of a
element however, works just fine, with the request passing.
Expected Behavior
I expect to have the same bahavior possible through using a element or programmatically making an HttpClient and a request.
Steps To Reproduce
Follow the documentation. Create a template project, use the example code and it will not work.
Exceptions (if any)
No response
.NET Version
.net8
Anything else?
No response