{"action":"created","issue":{"url":"https://api.github.com/repos/microauth/microauth-facebook/issues/3","repository_url":"https://api.github.com/repos/microauth/microauth-facebook","labels_url":"https://api.github.com/repos/microauth/microauth-facebook/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/microauth/microauth-facebook/issues/3/comments","events_url":"https://api.github.com/repos/microauth/microauth-facebook/issues/3/events","html_url":"https://github.com/microauth/microauth-facebook/issues/3","id":228572517,"node_id":"MDU6SXNzdWUyMjg1NzI1MTc=","number":3,"title":"Client example?","user":{"login":"glenarama","id":6705116,"node_id":"MDQ6VXNlcjY3MDUxMTY=","avatar_url":"https://avatars0.githubusercontent.com/u/6705116?v=4","gravatar_id":"","url":"https://api.github.com/users/glenarama","html_url":"https://github.com/glenarama","followers_url":"https://api.github.com/users/glenarama/followers","following_url":"https://api.github.com/users/glenarama/following{/other_user}","gists_url":"https://api.github.com/users/glenarama/gists{/gist_id}","starred_url":"https://api.github.com/users/glenarama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glenarama/subscriptions","organizations_url":"https://api.github.com/users/glenarama/orgs","repos_url":"https://api.github.com/users/glenarama/repos","events_url":"https://api.github.com/users/glenarama/events{/privacy}","received_events_url":"https://api.github.com/users/glenarama/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-14T21:48:59Z","updated_at":"2018-09-09T18:27:13Z","closed_at":null,"author_association":"NONE","body":"Are you able to provide any guidance on calling this from client side and receiving in response the output\r\nThe current example just posts to the browser window and I'd like to consume this from a fetch or page load - neither of which I seem to be able to get working. \r\n\r\nThanks\r\n"},"comment":{"url":"https://api.github.com/repos/microauth/microauth-facebook/issues/comments/419735041","html_url":"https://github.com/microauth/microauth-facebook/issues/3#issuecomment-419735041","issue_url":"https://api.github.com/repos/microauth/microauth-facebook/issues/3","id":419735041,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTczNTA0MQ==","user":{"login":"infernalmaster","id":1155618,"node_id":"MDQ6VXNlcjExNTU2MTg=","avatar_url":"https://avatars0.githubusercontent.com/u/1155618?v=4","gravatar_id":"","url":"https://api.github.com/users/infernalmaster","html_url":"https://github.com/infernalmaster","followers_url":"https://api.github.com/users/infernalmaster/followers","following_url":"https://api.github.com/users/infernalmaster/following{/other_user}","gists_url":"https://api.github.com/users/infernalmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/infernalmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infernalmaster/subscriptions","organizations_url":"https://api.github.com/users/infernalmaster/orgs","repos_url":"https://api.github.com/users/infernalmaster/repos","events_url":"https://api.github.com/users/infernalmaster/events{/privacy}","received_events_url":"https://api.github.com/users/infernalmaster/received_events","type":"User","site_admin":false},"created_at":"2018-09-09T18:27:13Z","updated_at":"2018-09-09T18:27:13Z","author_association":"NONE","body":"Easy solution will be to make server return html, that sets auth data to localStorage.\r\n\r\n```js\r\nmodule.exports = (req, res, auth) => {\r\n  if (req.url.includes('/auth/facebook/callback')) {\r\n    const html = `\r\n    <script>\r\n      let auth = ${JSON.stringify(auth)}\r\n      localStorage.setItem('auth', JSON.stringify(auth));\r\n      window.close()\r\n    </script>\r\n    `\r\n    return html\r\n  }\r\n}\r\n```\r\n\r\nThen on client you can open fb login in popup\r\n\r\n```js\r\nwindow.addEventListener(\r\n  'storage',\r\n  data => {\r\n    if (data.key === 'auth') {\r\n      console.log(JSON.parse(data.newValue))\r\n    }\r\n  },\r\n  false\r\n)\r\n\r\nwindow.open(`${window.location.origin}/auth/facebook`,'ghPopup','height=600,width=500')\r\n```\r\n\r\nBut IMHO better to create app token (maybe JWT) from FB auth data and store it on localStorage"}}
{"actor":{"display_login":"infernalmaster"}}