Closed AdaskoTheBeAsT closed 2 years ago
for now I tried to do some preflight to "get" endpoint and extract value from cookie
var setCookieHeaderValues = result.Context.Response.GetTypedHeaders().SetCookie; var xsrfTokenCookie = setCookieHeaderValues.First(v => v.Name.Equals(XsrfCookieName, StringComparison.OrdinalIgnoreCase)); XsrfTokenValue = xsrfTokenCookie.Value.Value;
and then use XsrfTokenValue
_.WithRequestHeader(XsrfHeaderName, XsrfTokenValue ?? string.Empty); _.Post.Json(request).ToUrl("/api/<some endpoint>");
for now I receive 400 not sure if I missed something (without ValidateAntiForgeryToken attribute it works so it is only problem with antiforgery)
Do you have any tips?
ok found it - I need to also save whole cookie and add it in request
for now I tried to do some preflight to "get" endpoint and extract value from cookie
and then use XsrfTokenValue
for now I receive 400 not sure if I missed something (without ValidateAntiForgeryToken attribute it works so it is only problem with antiforgery)
Do you have any tips?