{"action":"created","issue":{"url":"https://api.github.com/repos/joshuef/safe-js/issues/10","repository_url":"https://api.github.com/repos/joshuef/safe-js","labels_url":"https://api.github.com/repos/joshuef/safe-js/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/joshuef/safe-js/issues/10/comments","events_url":"https://api.github.com/repos/joshuef/safe-js/issues/10/events","html_url":"https://github.com/joshuef/safe-js/issues/10","id":184023779,"number":10,"title":"auth.js authorise(packageData, tokenKey) fails if optional tokenKey is omitted","user":{"login":"theWebalyst","id":2183895,"avatar_url":"https://avatars.githubusercontent.com/u/2183895?v=3","gravatar_id":"","url":"https://api.github.com/users/theWebalyst","html_url":"https://github.com/theWebalyst","followers_url":"https://api.github.com/users/theWebalyst/followers","following_url":"https://api.github.com/users/theWebalyst/following{/other_user}","gists_url":"https://api.github.com/users/theWebalyst/gists{/gist_id}","starred_url":"https://api.github.com/users/theWebalyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theWebalyst/subscriptions","organizations_url":"https://api.github.com/users/theWebalyst/orgs","repos_url":"https://api.github.com/users/theWebalyst/repos","events_url":"https://api.github.com/users/theWebalyst/events{/privacy}","received_events_url":"https://api.github.com/users/theWebalyst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-19T17:20:41Z","updated_at":"2016-10-26T11:12:46Z","closed_at":null,"body":"README.md says auth.js authorise(packageData, tokenKey) where tokenKey is \"optional\", but if tokenKey is omitted and the browser has local storage, then getAuthToken( tokenString ) below will be called with tokenString undefined, which is an error: \r\n\r\n```\r\nexport const authorise = function( packageData, token )\r\n{   \r\n    let tokenString = token;\r\n\r\n    // for beaker only. Otherwise use localStorage.\r\n    if( !localStorageExists && this && this.sender )\r\n    {\r\n        // get the webcontents url\r\n        const wholeUrl = this.sender.getURL()\r\n        const parsedUrl = url.parse( wholeUrl );\r\n        tokenString = parsedUrl.hostname;\r\n        \r\n        //override vendor with the url?\r\n        if( packageData )\r\n            packageData.vendor = wholeUrl;\r\n        \r\n    }\r\n    \r\nlet tokenFromStorage = getAuthToken( tokenString );\r\n```\r\nSee: https://github.com/joshuef/safe-js/blob/master/src/auth.js#L60-L78\r\n"},"comment":{"url":"https://api.github.com/repos/joshuef/safe-js/issues/comments/256317442","html_url":"https://github.com/joshuef/safe-js/issues/10#issuecomment-256317442","issue_url":"https://api.github.com/repos/joshuef/safe-js/issues/10","id":256317442,"user":{"login":"theWebalyst","id":2183895,"avatar_url":"https://avatars.githubusercontent.com/u/2183895?v=3","gravatar_id":"","url":"https://api.github.com/users/theWebalyst","html_url":"https://github.com/theWebalyst","followers_url":"https://api.github.com/users/theWebalyst/followers","following_url":"https://api.github.com/users/theWebalyst/following{/other_user}","gists_url":"https://api.github.com/users/theWebalyst/gists{/gist_id}","starred_url":"https://api.github.com/users/theWebalyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theWebalyst/subscriptions","organizations_url":"https://api.github.com/users/theWebalyst/orgs","repos_url":"https://api.github.com/users/theWebalyst/repos","events_url":"https://api.github.com/users/theWebalyst/events{/privacy}","received_events_url":"https://api.github.com/users/theWebalyst/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T11:12:46Z","updated_at":"2016-10-26T11:12:46Z","body":"I agree, to remove it seems sensible. I think it is something best explicitly handled by the app, not hidden in a library. There's no reason not to provide a separate helper/helpers (e.g. to encourage secure or sensible handling of tokens in browser storage), but hiding what's happening seems more unhelpful than helpful :-)"}}
{"actor":{"display_login":"theWebalyst"}}