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);

pfx voor iis maken


installeer openssl 
on mac: brew install openssl

maak van je private key texte een file private.key en ca een ca.crt en van je crt een crt file. 

openssl pkcs12 -export -out ~/downloads/extending.pfx -inkey ~/downloads/extending-private.key -in ~/downloads/extending.crt -certfile ~/downloads/extending-ca.crt

zie ook:
https://www.sslcertificaten.nl/support/OpenSSL/Meest_gebruikte_OpenSSL_opdrachten