{"action":"created","issue":{"url":"https://api.github.com/repos/apache/couchdb/issues/1598","repository_url":"https://api.github.com/repos/apache/couchdb","labels_url":"https://api.github.com/repos/apache/couchdb/issues/1598/labels{/name}","comments_url":"https://api.github.com/repos/apache/couchdb/issues/1598/comments","events_url":"https://api.github.com/repos/apache/couchdb/issues/1598/events","html_url":"https://github.com/apache/couchdb/issues/1598","id":358054707,"node_id":"MDU6SXNzdWUzNTgwNTQ3MDc=","number":1598,"title":"Request: Include cookie expiry time in Set-Cookie header","user":{"login":"flimzy","id":8555063,"node_id":"MDQ6VXNlcjg1NTUwNjM=","avatar_url":"https://avatars0.githubusercontent.com/u/8555063?v=4","gravatar_id":"","url":"https://api.github.com/users/flimzy","html_url":"https://github.com/flimzy","followers_url":"https://api.github.com/users/flimzy/followers","following_url":"https://api.github.com/users/flimzy/following{/other_user}","gists_url":"https://api.github.com/users/flimzy/gists{/gist_id}","starred_url":"https://api.github.com/users/flimzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flimzy/subscriptions","organizations_url":"https://api.github.com/users/flimzy/orgs","repos_url":"https://api.github.com/users/flimzy/repos","events_url":"https://api.github.com/users/flimzy/events{/privacy}","received_events_url":"https://api.github.com/users/flimzy/received_events","type":"User","site_admin":false},"labels":[{"id":594291183,"node_id":"MDU6TGFiZWw1OTQyOTExODM=","url":"https://api.github.com/repos/apache/couchdb/labels/enhancement","name":"enhancement","color":"5EBEFF","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-07T12:51:23Z","updated_at":"2018-09-07T14:08:51Z","closed_at":"2018-09-07T14:08:51Z","author_association":"MEMBER","body":"When writing CouchDB clients that use Cookie auth, it would be very beneficial to have some idea when the authentication is about to expire, or already has expired, so that authentication can be re-done to refresh the cookie.\r\n\r\nAt present, CouchDB doesn't give any such clues to the client.  Example (with CouchDB 2.2.20):\r\n\r\n    $ curl -v -X POST http://localhost:6004/_session -H 'Content-Type: application/json' -d '{\"name\":\"admin\",\"password\":\"abc123\"}'\r\n    Note: Unnecessary use of -X or --request, POST is already inferred.\r\n    *   Trying ::1...\r\n    * TCP_NODELAY set\r\n    * Connected to localhost (::1) port 6004 (#0)\r\n    > POST /_session HTTP/1.1\r\n    > Host: localhost:6004\r\n    > User-Agent: curl/7.52.1\r\n    > Accept: */*\r\n    > Content-Type: application/json\r\n    > Content-Length: 36\r\n    > \r\n    * upload completely sent off: 36 out of 36 bytes\r\n    < HTTP/1.1 200 OK\r\n    < Cache-Control: must-revalidate\r\n    < Content-Length: 46\r\n    < Content-Type: application/json\r\n    < Date: Fri, 07 Sep 2018 12:48:28 GMT\r\n    < Server: CouchDB/2.2.0 (Erlang OTP/19)\r\n    < Set-Cookie: AuthSession=YWRtaW46NUI5MjczOUM68IYzw6QYhBU0nLMTM-XQjuRdcrs; Version=1; Path=/; HttpOnly\r\n    < \r\n    {\"ok\":true,\"name\":\"admin\",\"roles\":[\"_admin\"]}\r\n\r\nMy request is that we add a `Max-Age` or `Expires` value to the `Set-Cookie` header. This should be set based on the session timeout value."},"comment":{"url":"https://api.github.com/repos/apache/couchdb/issues/comments/419451121","html_url":"https://github.com/apache/couchdb/issues/1598#issuecomment-419451121","issue_url":"https://api.github.com/repos/apache/couchdb/issues/1598","id":419451121,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTQ1MTEyMQ==","user":{"login":"eiri","id":70542,"node_id":"MDQ6VXNlcjcwNTQy","avatar_url":"https://avatars2.githubusercontent.com/u/70542?v=4","gravatar_id":"","url":"https://api.github.com/users/eiri","html_url":"https://github.com/eiri","followers_url":"https://api.github.com/users/eiri/followers","following_url":"https://api.github.com/users/eiri/following{/other_user}","gists_url":"https://api.github.com/users/eiri/gists{/gist_id}","starred_url":"https://api.github.com/users/eiri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eiri/subscriptions","organizations_url":"https://api.github.com/users/eiri/orgs","repos_url":"https://api.github.com/users/eiri/repos","events_url":"https://api.github.com/users/eiri/events{/privacy}","received_events_url":"https://api.github.com/users/eiri/received_events","type":"User","site_admin":false},"created_at":"2018-09-07T14:08:51Z","updated_at":"2018-09-07T14:08:51Z","author_association":"MEMBER","body":"Ah, this is already possible, just under documented 😞  There are also a configuration for cookie domain, for what it's worth.\r\n\r\nThe configuration looks like this:\r\n```ini\r\n[couch_httpd_auth]\r\nallow_persistent_cookies = true\r\ntimeout = 600\r\ncookie_domain = .asgard.org\r\n```\r\nand this gives:\r\n```bash\r\n$ curl -v http://127.0.0.1:15984/_session -H 'Content-Type: application/json' -d '{\"name\":\"odin\",\"password\":\"asgard\"}'\r\n*   Trying 127.0.0.1...\r\n* Connected to 127.0.0.1 (127.0.0.1) port 15984 (#0)\r\n> POST /_session HTTP/1.1\r\n...\r\n< Set-Cookie: AuthSession=b2Rpbjo1QjkyODYzQzpzHjxQ0b7aKwit3CnK7cCJ3Gt8PA; Version=1; Expires=Fri, 07-Sep-2018 14:17:56 GMT; Max-Age=600; Domain=.asgard.org; Path=/; HttpOnly\r\n```\r\n\r\n"}}
{"actor":{"display_login":"eiri"}}