Hallo,wenn ich von meinem WASM Client aus die ReCaptcha Seite wie folgt verifizieren möchte:
using (HttpClient httpClient = new HttpClient())
{
try
{
var response = await httpClient.PostAsync(url, content);
response.EnsureSuccessStatusCode();
verificationResponse = await response.Content.ReadFromJsonAsync<GoogleReCaptchAv2Response>();
}
Bekomme ich folgende Fehlermeldung:
Access to fetch at 'https://www.google.com/recaptcha/api/siteverify' from origin 'https://localhost:44392' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Wie und wo kann ihc no-cors einstellen?
Danke im voraus für jede Hilfe
P.S. Ich habe auf dem Server versucht:
builder.Services.AddCors(options =>
{
options.AddPolicy("CustomPolicy", bu =>
bu.WithOrigins()
.AllowAnyMethod()
.AllowAnyHeader());
});
app.UseCors("CustomPolicy");
Aber das hat niocht geholfen.