The required antiforgery cookie ".AspNetCore.Antiforgery.0p-kydK_Bmc" is not present. means the POST carried the hidden form token but not the antiforgery cookie that the GET of the form had set. Send the cookie back with the post, and the same token is accepted.

A client that fetches the form must store the cookies of that response and send them with the POST: with curl that is -c on the GET and -b on the POST.

The error

PS> curl.exe -s -i -d "@body-a.txt" -H "Accept: text/plain" http://127.0.0.1:15610/book | Select-Object -First 12
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
...

Microsoft.AspNetCore.Http.BadHttpRequestException: Invalid anti-forgery token found when reading parameter "string name" from the request body as form.
 ---> Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.0p-kydK_Bmc" is not present.
   at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateRequestAsync(HttpContext httpContext)
...

The text is the response body in the Development environment; the request sent Accept: text/plain and the body was this text. The cookie name in the message, .AspNetCore.Antiforgery.0p-kydK_Bmc, is the one this test app set on the GET.

Why it happens

The message says what was missing: the antiforgery cookie. The test fetched /form with a cookie jar, so the cookie was stored in jar-a.txt and the hidden field was written to body-a.txt. It then posted body-a.txt with no -b option. The request had a field and no cookie, and the answer was a 400 that names the cookie it expected.

One curl POST without -b was captured, and that was enough: curl sent no cookie and the form token alone was refused. The form field was the right one, taken from the page the same jar had fetched a moment earlier; the only thing missing from the request was the cookie the GET had set. If you see this message from a script, check first whether it sends any cookies at all, before you look at the token.

The fix

PS> curl.exe -s -b jar-a.txt -c jar-a.txt http://127.0.0.1:15610/form -o form.html
(wrote body-a.txt: name=Maria%20Garcia&__RequestVerificationToken=<token from form.html>)
...
PS> curl.exe -s -i -b jar-a.txt -d "@body-a.txt" -H "Accept: text/plain" http://127.0.0.1:15610/book
HTTP/1.1 200 OK
...

Booked for Maria Garcia.

The only change is -b jar-a.txt on the POST, the jar the GET wrote with -c. The same body file was accepted with 200.

How it was reproduced

A project from dotnet new web -n AfLab -f net10.0 on .NET SDK 11.0.100, no NuGet packages, running on ASP.NET Core 10.0.15 in Development on 127.0.0.1:15610: a GET /form endpoint that writes the hidden field from IAntiforgery.GetAndStoreTokens, a POST /book endpoint with [FromForm] string name, and app.UseAntiforgery(). Requests went through curl 8.22.0; the jar and body file names are the test's own.

Frequently asked

Why is the required antiforgery cookie not present when I post with curl?
curl does not keep cookies unless told to. Save them on the GET with -c jar.txt and send them on the POST with -b jar.txt; in the test the same form body went from 400 to 200 with that one change.
What is the .AspNetCore.Antiforgery cookie?
In the test it was set by the GET that rendered the form, and a POST of that form without it was refused with this message.
Which cookie name does the message print?
The name of the antiforgery cookie the app set; in this test it was .AspNetCore.Antiforgery.0p-kydK_Bmc, the same name the GET response had set. Compare it with the cookies your client actually sent.

More decoded errors in the Fixes category. For a Blazor page with a plain HTML form, see A valid antiforgery token was not provided with the request.