Hi,
I am able to get the built in restSettings for create,update,delete to work in IE but I encounter authorization problem in Chrome&Firefox.
I was able to get the datasource manually with angular and pass in withCredentials: true below.
is there a similar function i can use in IGniteui-angular2 iggrid?
Project:
.net core/ Angular 4/ Igniteui-angular2/ ignite ui 17.1
Angular:
getErrorTypes(): Observable<IErrorType[]> {
return this._http.get(this._errorTypesUrl, { withCredentials: true })
Error Message:
OPTIONS http://localhost/api/v1/CREERRORTYPES/1 401 (Unauthorized)
errortype:1 XMLHttpRequest cannot load http://localhost/api/v1/CREERRORTYPES/1. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:35636' is therefore not allowed access. The response had HTTP status code 401.
Hello,
I believe that this is due to the same origin policy. Here's how to disable it in chrome.
Can you provide a sample for further investigations?
The cors headers are handled by the api. that's why it's throwing the second error message(CORS) because it failed to authorize w/ the API ( 401 (Unauthorized)). The API require windows authentication.
Please find my sample code attached. You will need to replace the API url with the API that require windows authentication.
I am able to pass in withCredentials as a request option and it will send below request header to the api. is there a similar way to do it in IGGRID built in rest function?
home.service.ts
getHome(): Observable<IHome[]> { return this._http.get(this._testUrl, { withCredentials: true }) .map((response: Response) => <IHome[]>response.json()) .do(data => console.log('All: ' + JSON.stringify(data))) .catch(this.handleError); }
Request Header:
Authorization:Negotiate YIIjpAYGKwYBBQUCoIIjmDCCI5SgMDAuB......
Replace URL:
home.service.ts(_testUrl)
home.component.ts(restSettings)