{"action":"created","issue":{"url":"https://api.github.com/repos/timblack1/hoodie-accountbar/issues/2","labels_url":"https://api.github.com/repos/timblack1/hoodie-accountbar/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/timblack1/hoodie-accountbar/issues/2/comments","events_url":"https://api.github.com/repos/timblack1/hoodie-accountbar/issues/2/events","html_url":"https://github.com/timblack1/hoodie-accountbar/issues/2","id":92786102,"number":2,"title":"signOut() doesn't destroy Hoodie's record of session in browser","user":{"login":"timblack1","id":1031914,"avatar_url":"https://avatars.githubusercontent.com/u/1031914?v=3","gravatar_id":"","url":"https://api.github.com/users/timblack1","html_url":"https://github.com/timblack1","followers_url":"https://api.github.com/users/timblack1/followers","following_url":"https://api.github.com/users/timblack1/following{/other_user}","gists_url":"https://api.github.com/users/timblack1/gists{/gist_id}","starred_url":"https://api.github.com/users/timblack1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timblack1/subscriptions","organizations_url":"https://api.github.com/users/timblack1/orgs","repos_url":"https://api.github.com/users/timblack1/repos","events_url":"https://api.github.com/users/timblack1/events{/privacy}","received_events_url":"https://api.github.com/users/timblack1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-03T04:04:19Z","updated_at":"2015-07-03T13:57:17Z","closed_at":"2015-07-03T05:52:17Z","body":"When I sign out a user, Hoodie appears to not destroy that user's session.  The hard evidence is that:\r\n\r\n1.  Hoodie continues to ping the server (to keep that user's session alive?) at BOTH that user's API endpoint (e.g., /_api/?hoodieId=lhxc60o) AND at the anonymous user's API endpoint (e.g., /_api/?hoodieId=nve83kl).  It should ping only the anonymous user's API endpoint instead.\r\n2.  When I sign up as a new user then write to the database, user 2's writes end up in user 1's database in CouchDB.  It should write user 2's doc to user 2's database instead.\r\n\r\nWhy is Hoodie doing this and how can I get it to work correctly?\r\n\r\n@gr2m, I tried to replicate this error outside my own application in a test environment, and was not able to replicate it.  So now I should try to figure out what is different between my app and the test environment.  So I don't need you to follow up on this yet.\r\n\r\n--------\r\n\r\nThe steps I followed to attempt to replicate the error are as follows.\r\n\r\nCreate a Polymer app:\r\n\r\n`$ yo polymer`\r\n\r\nAdd hoodie-accountbar as a dependency in bower.json:\r\n\r\n    \"hoodie-accountbar\": \"latest\"\r\n\r\nInstall hoodie-accountbar:\r\n\r\n`$ bower install`\r\n\r\nCopy the following two files into your app's root directory:\r\n\r\ngulpfile.js - https://gist.github.com/timblack1/18242e8db18ad2049760\r\npackage.json - https://gist.github.com/timblack1/969bd5111cbf5defae90\r\n\r\nInstall Hoodie & Gulp dependencies\r\n\r\n`$ npm install`\r\n\r\nImport hoodie-accountbar into app/elements/elements.html by pasting in the following:\r\n\r\n    <link rel=\"import\" href=\"../bower_components/hoodie-accountbar/hoodie-accountbar.html\">\r\n\r\nPlace hoodie-accountbar somewhere visible within the <body> element in app/index.html:\r\n\r\n    <hoodie-accountbar></hoodie-accountbar>\r\n\r\nOptionally comment out the `<platinum-sw-register>` element (and if you've already loaded the app in your browser, unregister the service worker at chrome://serviceworker-internals/) to disable the service worker cache.\r\n\r\nServe the app:\r\n\r\n`$ gulp serve`\r\n\r\n(As an alternative, you can use `$ gulp hoodie` to first dynamically generate hoodie.js containing your specific set of Hoodie plugins and write it to the hoodie-service element's directory, then it runs `gulp serve` for you once that is done.)\r\n\r\nSign up a user using the buttons & dialogs.  Write a doc to the database:\r\n\r\n`$ document.querySelector('hoodie-accountbar').hoodie.store.add('test', {'test':'test1'})`\r\n\r\nSign out.  Watch your network tab for a few minutes to see if Hoodie keeps pinging the signed-out user's API endpoint.\r\n\r\nSign up a new user and write a new doc to the database.  See if that doc goes to the correct user database at http://localhost:3004/_utils."},"comment":{"url":"https://api.github.com/repos/timblack1/hoodie-accountbar/issues/comments/118358068","html_url":"https://github.com/timblack1/hoodie-accountbar/issues/2#issuecomment-118358068","issue_url":"https://api.github.com/repos/timblack1/hoodie-accountbar/issues/2","id":118358068,"user":{"login":"timblack1","id":1031914,"avatar_url":"https://avatars.githubusercontent.com/u/1031914?v=3","gravatar_id":"","url":"https://api.github.com/users/timblack1","html_url":"https://github.com/timblack1","followers_url":"https://api.github.com/users/timblack1/followers","following_url":"https://api.github.com/users/timblack1/following{/other_user}","gists_url":"https://api.github.com/users/timblack1/gists{/gist_id}","starred_url":"https://api.github.com/users/timblack1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timblack1/subscriptions","organizations_url":"https://api.github.com/users/timblack1/orgs","repos_url":"https://api.github.com/users/timblack1/repos","events_url":"https://api.github.com/users/timblack1/events{/privacy}","received_events_url":"https://api.github.com/users/timblack1/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T13:57:17Z","updated_at":"2015-07-03T13:57:17Z","body":"While this was a problem that was easy for me to correct in my own app's structure, yet it was hard to debug.  So I wonder whether it would be wise for Hoodie to keep a Window-global register of Hoodie instances, keyed by their `baseUrl`s, so as to not allow two Hoodie instances with the same `baseUrl` in the same Window.  Which is the more common use-case:  accidentally creating two Hoodie instances, or intentionally creating two Hoodie instances (effectively two users in one app)?  If both use-cases are expected, then it might not be wise to force users to use only one."}}