dinsdag 7 april 2020

Cross origin from osX/iOS

vanaf safari op mac / ios kun je geen post naar http meer doen. gebruik altijd ssl
denk vervolgens aan je CORS in je api service.
in asp.net core gebruik je:

string[] corsorigin = Configuration["Cors"].Split(',',StringSplitOptions.RemoveEmptyEntries).ToArray();
app.UseCors(builder =>
builder.WithOrigins(corsorigin).AllowAnyHeader().AllowAnyMethod().AllowCredentials());

gebruik vanaf je webclient een withCredentials: true

const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
}),
withCredentials :true

return this.httpClient.post<type>('url', object , httpOptions);

Geen opmerkingen:

Een reactie posten