Use cookie session authentication from localhost

I’m trying to authenticate with a SOAP service with session cookie authentication.

First I do login with the server and it runs fine but when I try to request other resource with the cookie it now works because the cookie is not sent to the server.

The request to the server are like this:

this.http.post(wsurl, xml, {headers: headers })...

I have activated the chrome extension to allow origins and disable CORS but the request not send the cookie to the request.

Also I’ve tried to add to the request this:

   `this.http.post(wsurl, xml, {withCredentials: true, headers: headers })...`

But in this case the response error is this:

Response to preflight request doesn't pass access control check: The
value of the 'Access-Control-Allow-Origin' header in the response must
not be the wildcard '*' when the request's credentials mode is
'include'. Origin 'http://localhost:8100' is therefore not allowed
access. The credentials mode of requests initiated by the
XMLHttpRequest is controlled by the withCredentials attribute.

On the real device it works fine but on ionic serve and emulator with -livereload not works

What I’m doing wrong?

1 Like

Someone can help me? I can’t have access to the api server and i don’t know to do…