ionic-team / ionic-team/cordova-plugin-ionic-webview

Secure and HttpOnly cookies setted by server not sent to subsequent http requests

Open
#616 16 comments 7 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
493
Forks
410
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have an Ionic App with this specs:

```
-Ionic 3.9.2
-Angular 5.2.11
-Cordova Android 8.1.0 and iOS 5.1.1
-Cordova 8.0.0

**-cordova-plugin-ionic-webview 5.0.0**
```

My app make request to a SOAP backend which is secured with a HttpOnly secure cookie JSESSIONID (Tomcat server).

I have enabled CORS so that my requests are able to reach the backend, this is the Tomcat CORS filter:

```

CorsFilter
org.apache.catalina.filters.CorsFilter

cors.allowed.origins
ionic://localhost,http://localhost


cors.allowed.methods
GET,POST,HEAD,OPTIONS,PUT


cors.allowed.headers
Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,SOAPAction,Cache-Control


cors.exposed.headers
Access-Control-Allow-Origin,Access-Control-Allow-Credentials


cors.support.credentials
true


cors.preflight.maxage
10

CorsFilter
/*

```

When I do login against the backend the server SETS a cookie (JSESSION):

`Set-Cookie: JSESSIONID=00000000....; Path=/; Secure; HttpOnly`

Which it would be used to send in subsequent request to backend to authenticate in secured WS. This is the code to make request with httpclient angular(Same for subsequent request)

```
this.http.**post**(wsurl, xml, {
**withCredentials: true,**
responseType: 'text',
headers: headers,
observe: 'response'
})
.toPromise()
.then(response => {})
.catch(err =>{})
```

The problem is on iOS/safari , the subsequent request not sent the `Cookie` Header with the JSESSIONID value. **On Android, chrome works fine**

A strange additional info:

> Same build of app deployed on Iphone 6 iOS v12.4.5 works fine. On a iPhone X with iOS v 14 and simulators(any version) not work.

¿What would be the problem? How can I fix this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.