{ "id": "151382", "key": "TIMOB-20075", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2015-09-22T14:24:32.000+0000", "priority": null, "labels": [ "Community", "android", "cookies", "webView" ], "versions": [], "issuelinks": [ { "id": "58634", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "119505", "key": "TIMOB-15434", "fields": { "summary": "Android: Cookies are not preserved after closing the app", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-08-18T20:42:48.000+0000", "status": { "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "name": "Reopened", "id": "4", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "On SDK 5.0 Titanium.Network.addSystemCookie doesn't work as expected when trying to add cookies to a webview.\r\nIn SDK 3.5 our code works fine.\r\nThe use case is that a login is done in the main app and the session cookie returned needs to be used on our webviews.\r\nHere is the code that does that.\r\n\r\n{code:java}\r\nif (osname === 'android') {\r\n var sessionCookie = _.findWhere(\r\n Titanium.Network.getHTTPCookiesForDomain(\r\n Ti.App.Properties.getString('siteUrl').match(/^https?:\\/\\/(?:www\\.)?([^\\/^:]+)[:\\/$]?/i)[1]\r\n ),\r\n {name: 'JSESSIONID'}\r\n );\r\n Titanium.Network.removeAllSystemCookies();\r\n Titanium.Network.addSystemCookie(sessionCookie);\r\n}\r\n{code}\r\n\r\nI have confirmed that sessionCookie is correct and that it is not being used in the webview (using chrome inspect a simple ajax request doesn't send the cookie).\r\nThis used to work fine on 3.5 (not sure about 4 though, we migrated 3.5 -> 5).", "attachment": [], "flagged": false, "summary": "Android: Titanium.Network.addSystemCookie not adding cookie to webview", "creator": { "name": "filaruina", "key": "filaruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "filaruina", "key": "filaruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Operating System\r\n Name = Microsoft Windows 7 Ultimate\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8379293696\r\n\r\nNode.js\r\n Node.js Version = 0.10.35\r\n npm Version = 1.4.28\r\n\r\nTitanium CLI\r\n CLI Version = 5.0.4\r\n\r\nTitanium SDK\r\n SDK Version = 5.0.0.GA\r\n Target Platform = android", "comment": { "comments": [ { "id": "364636", "author": { "name": "filaruina", "key": "filaruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Just noticed this is a problem with android target 21 instead of 19 (we had to change it for the new SDK).\r\nIf I use sdk 3.5 on target 21 the same problem happens. Target 19 works fine using sdk 3.5.", "updateAuthor": { "name": "filaruina", "key": "filaruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-09-22T14:58:59.000+0000", "updated": "2015-09-22T15:01:34.000+0000" }, { "id": "364697", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "CookieSyncManager is deprecated in API 21: http://developer.android.com/reference/android/webkit/CookieSyncManager.html. See https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/network/src/java/ti/modules/titanium/network/NetworkModule.java#L502. However deprecated is different than removed.\r\n\r\n", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-09-22T20:27:46.000+0000", "updated": "2015-09-22T20:27:46.000+0000" }, { "id": "364721", "author": { "name": "filaruina", "key": "filaruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "body": "That is even stranger since it says in the android docs that it will \"automatically sync cookies as necessary\".\r\nThe cookies set in http request in the app aren't used in webviews.", "updateAuthor": { "name": "filaruina", "key": "filaruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-09-22T21:32:49.000+0000", "updated": "2015-09-22T21:32:49.000+0000" }, { "id": "368597", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "body": "Hi ,\r\nThis is an android issue . CookieSyncManager is deprecated in API 21 \r\nThanks", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2015-11-02T08:41:34.000+0000", "updated": "2015-11-23T06:04:51.000+0000" }, { "id": "371143", "author": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "body": "So what's the solution?\r\nTitanium uses a deprecated/not working feature, what is the alternative here?\r\nSDK 5 requires android 21 so this should be addressed somehow, even if that means you don't support sharing cookies anymore.\r\nClosing this as \"Not Our Bug\" is the worst way of \"solving\" a problem.", "updateAuthor": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-23T11:59:23.000+0000", "updated": "2015-11-23T12:00:29.000+0000" }, { "id": "371147", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I agree. According to the docs, this should \"just work\" even with a deprecated method. It is possible it is an actual Google bug however, but the auto-sync stuff should work.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-23T14:35:32.000+0000", "updated": "2015-11-23T14:35:32.000+0000" }, { "id": "423121", "author": { "name": "nipoul", "key": "nipoul", "displayName": "Nikos Poulios", "active": true, "timeZone": "Europe/Berlin" }, "body": "I noticed that android get/addSystemCookie is not working on Android 6.1.0.GA. After some testing I found out that those functions were not working on previous versions either (5.4.1/6.0.4) but it was noticed now in 6.1.0.GA, because I suppose that cookies were auto synced with the webview and in 6.1.0.GA cookies are not available after you restart the app", "updateAuthor": { "name": "nipoul", "key": "nipoul", "displayName": "Nikos Poulios", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-06-29T08:03:56.000+0000", "updated": "2017-06-29T08:03:56.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }