{"action":"created","issue":{"url":"https://api.github.com/repos/nteract/nteract/issues/846","repository_url":"https://api.github.com/repos/nteract/nteract","labels_url":"https://api.github.com/repos/nteract/nteract/issues/846/labels{/name}","comments_url":"https://api.github.com/repos/nteract/nteract/issues/846/comments","events_url":"https://api.github.com/repos/nteract/nteract/issues/846/events","html_url":"https://github.com/nteract/nteract/pull/846","id":179684619,"number":846,"title":"[WIP] improve(GithubAuth): Add authenticated to app record, rework auth flow.","user":{"login":"jdetle","id":10944582,"avatar_url":"https://avatars.githubusercontent.com/u/10944582?v=3","gravatar_id":"","url":"https://api.github.com/users/jdetle","html_url":"https://github.com/jdetle","followers_url":"https://api.github.com/users/jdetle/followers","following_url":"https://api.github.com/users/jdetle/following{/other_user}","gists_url":"https://api.github.com/users/jdetle/gists{/gist_id}","starred_url":"https://api.github.com/users/jdetle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdetle/subscriptions","organizations_url":"https://api.github.com/users/jdetle/orgs","repos_url":"https://api.github.com/users/jdetle/repos","events_url":"https://api.github.com/users/jdetle/events{/privacy}","received_events_url":"https://api.github.com/users/jdetle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-09-28T05:40:57Z","updated_at":"2016-09-28T18:10:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nteract/nteract/pulls/846","html_url":"https://github.com/nteract/nteract/pull/846","diff_url":"https://github.com/nteract/nteract/pull/846.diff","patch_url":"https://github.com/nteract/nteract/pull/846.patch"},"body":"This is initial work towards fixing the github authorization flow. I think adding 'authenticated' to the app record is a good idea. Initially my thought was to go with a function in src/main/menu called publishAuth:\r\n```javascript\r\nexport function githubAuth(item, focusedWindow) {\r\n  const win = new BrowserWindow({ show: false,\r\n                                  webPreferences: { zoomFactor: 0.75 } });\r\n  win.webContents.on('dom-ready', () => {\r\n    if (win.getURL().indexOf('callback?code=') !== -1) {\r\n      win.webContents.executeJavaScript(`\r\n        require('electron').ipcRenderer.send('auth', document.body.textContent);\r\n        `);\r\n      ipc.on('auth', (event, auth) => {\r\n        const authorization = JSON.parse(auth);\r\n        send(focusedWindow, 'menu:publish:auth', authorization.access_token);\r\n        win.close();\r\n        return;\r\n      });\r\n    } else {\r\n      win.show();\r\n    }\r\n  });\r\n  win.loadURL('https://nteract-oauth.now.sh/github');\r\n}\r\n```\r\n\r\nand:\r\n```javascript\r\npublishAuthAndGist(){\r\n   publishAuth();\r\n   createSender('menu:publish:gist');\r\n}\r\n```\r\nbut theres some issue with synchronicity. Gonna pair with @captainsafia on this right now.\r\n"},"comment":{"url":"https://api.github.com/repos/nteract/nteract/issues/comments/250250945","html_url":"https://github.com/nteract/nteract/pull/846#issuecomment-250250945","issue_url":"https://api.github.com/repos/nteract/nteract/issues/846","id":250250945,"user":{"login":"rgbkrk","id":836375,"avatar_url":"https://avatars.githubusercontent.com/u/836375?v=3","gravatar_id":"","url":"https://api.github.com/users/rgbkrk","html_url":"https://github.com/rgbkrk","followers_url":"https://api.github.com/users/rgbkrk/followers","following_url":"https://api.github.com/users/rgbkrk/following{/other_user}","gists_url":"https://api.github.com/users/rgbkrk/gists{/gist_id}","starred_url":"https://api.github.com/users/rgbkrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgbkrk/subscriptions","organizations_url":"https://api.github.com/users/rgbkrk/orgs","repos_url":"https://api.github.com/users/rgbkrk/repos","events_url":"https://api.github.com/users/rgbkrk/events{/privacy}","received_events_url":"https://api.github.com/users/rgbkrk/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T18:10:19Z","updated_at":"2016-09-28T18:10:19Z","body":"User Gist makes sense."}}
{"actor":{"display_login":"rgbkrk"}}