{"action":"created","issue":{"url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/595","repository_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend","labels_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/595/labels{/name}","comments_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/595/comments","events_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/595/events","html_url":"https://github.com/goodjoblife/WorkTimeSurvey-backend/pull/595","id":459173716,"node_id":"MDExOlB1bGxSZXF1ZXN0MjkwNTg5MTEw","number":595,"title":"[RFC] Feature: add /auth/google to verifiy google token","user":{"login":"LittleWhiteYA","id":11289529,"node_id":"MDQ6VXNlcjExMjg5NTI5","avatar_url":"https://avatars0.githubusercontent.com/u/11289529?v=4","gravatar_id":"","url":"https://api.github.com/users/LittleWhiteYA","html_url":"https://github.com/LittleWhiteYA","followers_url":"https://api.github.com/users/LittleWhiteYA/followers","following_url":"https://api.github.com/users/LittleWhiteYA/following{/other_user}","gists_url":"https://api.github.com/users/LittleWhiteYA/gists{/gist_id}","starred_url":"https://api.github.com/users/LittleWhiteYA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LittleWhiteYA/subscriptions","organizations_url":"https://api.github.com/users/LittleWhiteYA/orgs","repos_url":"https://api.github.com/users/LittleWhiteYA/repos","events_url":"https://api.github.com/users/LittleWhiteYA/events{/privacy}","received_events_url":"https://api.github.com/users/LittleWhiteYA/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2019-06-21T12:30:25Z","updated_at":"2019-07-03T16:49:17Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/pulls/595","html_url":"https://github.com/goodjoblife/WorkTimeSurvey-backend/pull/595","diff_url":"https://github.com/goodjoblife/WorkTimeSurvey-backend/pull/595.diff","patch_url":"https://github.com/goodjoblife/WorkTimeSurvey-backend/pull/595.patch"},"body":"#577 \r\n\r\n## 這個 PR 是？ <!-- 必填 -->\r\n\r\n提供驗證 google token 的 API\r\n\r\n## 我應該從何看起？  <!-- 選填，沒有就刪掉 -->\r\n\r\n~參考 https://github.com/jaredhanson/passport-google-oauth2~\r\n參考\r\nhttps://developers.google.com/identity/sign-in/web/backend-auth\r\nhttps://github.com/googleapis/google-auth-library-nodejs#oauth2\r\nhttps://github.com/goodjoblife/WorkTimeSurvey-backend/issues/510\r\n\r\n## 若可以手動測試，要如何測試？ <!-- 選填 -->\r\n\r\n`curl -X POST \"http://localhost:3000/auth/google\" -H \"Content-Type: application/json\" --data '{\"id_token\":\"xxx\"}'`\r\n如果有吐回 user 和 token 就算正常了\r\n\r\n要注意的是這邊帶的是 google 的 id_token\r\n要怎麼拿到 id_token？\r\n- 可以參考 https://github.com/googleapis/google-auth-library-nodejs#oauth2 的範例\r\n```\r\n...\r\nconst r = await oAuth2Client.getToken(code);\r\n...\r\n```\r\n這行的 r.tokens 就有包含 id_token 了\r\n\r\n如何確定 id_token 是對的？\r\n- 可以丟到 https://jwt.io/ 上，如果解析的出來的話就是對的"},"comment":{"url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/comments/508171657","html_url":"https://github.com/goodjoblife/WorkTimeSurvey-backend/pull/595#issuecomment-508171657","issue_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/595","id":508171657,"node_id":"MDEyOklzc3VlQ29tbWVudDUwODE3MTY1Nw==","user":{"login":"mark86092","id":1908007,"node_id":"MDQ6VXNlcjE5MDgwMDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1908007?v=4","gravatar_id":"","url":"https://api.github.com/users/mark86092","html_url":"https://github.com/mark86092","followers_url":"https://api.github.com/users/mark86092/followers","following_url":"https://api.github.com/users/mark86092/following{/other_user}","gists_url":"https://api.github.com/users/mark86092/gists{/gist_id}","starred_url":"https://api.github.com/users/mark86092/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mark86092/subscriptions","organizations_url":"https://api.github.com/users/mark86092/orgs","repos_url":"https://api.github.com/users/mark86092/repos","events_url":"https://api.github.com/users/mark86092/events{/privacy}","received_events_url":"https://api.github.com/users/mark86092/received_events","type":"User","site_admin":false},"created_at":"2019-07-03T16:49:17Z","updated_at":"2019-07-03T16:49:17Z","author_association":"CONTRIBUTOR","body":"再請 @LittleWhiteYA 幫忙看一下 google login 可以拿到哪些欄位：\r\n\r\n從 FB 登入，我們會把缺失的 email, name 補上（如果有欄位的話）\r\nRef:\r\nhttps://github.com/goodjoblife/WorkTimeSurvey-backend/blob/master/src/routes/auth/index.js#L40-L63\r\n"}}
{"actor":{"display_login":"mark86092"}}