Get Set-Cookie header response in AngularJS after a XHR request


#1

Hi everybody,
I’m building a Cordova hybrid app using Ionic framework and AngularJS.

I need to make a REST call to make a login in a webservice.
I’ve written some Javascript code and the login works and the webservice answers me with a http 204 code so everything it’s ok.
Btw the webservice answers me with an header response that cointains a “Set-Cookie” field that I need to make the next call in the right way.
The problem is that from Angular I cant access that field.

I’ve also read "that XHR by it’s specification, doesn’t support SET-COOKIE, so it have nothing to do with AngularJS in particular."
In particular “The getAllResponseHeaders() method returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.

So the only way to access that field is using ngCookies angular module but this way doesn’t work for me because from the local webview I cant see cookies set from my webservice because they belong to a different domain.

Unfortunately I cant edit the webservice response and let the server send me that field in other ways, so I have to solve the problem from Cordova/Ionic side.

Do you have some advices?
thanks in advance


#2

Hi @nexatw ,
I am having the same issue.

Have you found any solution?

Thanks in advance! :slight_smile: