מצאתי המון תוצאות בגוגל שהן לא רלוונטיות,
לבסוף מצאתי את ההתכתבות הבאה:https://github.com/angular/angular/issues/15805
שמתי לב לפוסט הבא:
I'm in an Windows env. with NTLM, I got the same problem with CORS. I resolve it by removing headers from the options, it's feels like when adding headers, withCredentials gets overruled! I'm using http 4.3.1 Gives 401 let body = JSON.stringify(data); let headers = new Headers({'Content-Type': 'application/json'}); let options = new RequestOptions({headers: headers, withCredentials: true}); Works: let body = JSON.stringify(data); let options = new RequestOptions({withCredentials: true});
|
והבנתי שברגע שמגדירים Content-Type יש את הבעיה.
(והייתי חייב להגדיר כי השרת לא הכיר text/plan, שזה גם משהו שעם GET לא נתקלתי בו..)
ואז ראיתי עוד פוסט:
I upgrading from Angularjs to Angular 4, after authentication, I call WS spring to get a list of objects : angularjs (it's working) : the request header contains a parameter called Cookie, his value include all parameters from Set-Cookie response angular 4 (KO 401) : Cookie parameter not contains Set-Cookie response parameters. Using or not header/withCredentials, I have always 401 Unauthorized : Spring exception : org.springframework.security.authentication.InsufficientAuthenticationException: Full authentication is required to access this resource this.headers.append( 'Content-Type', 'application/x-www-form-urlencoded' );
|
והגדרתי, ואם להיות אמיתי, בלי להבין למה,
את ה- Content-Type הבא: application/x-www-form-urlencoded
והופ - זה עובד
תודה לכולם