{"action":"created","issue":{"url":"https://api.github.com/repos/feathersjs/feathers-rest/issues/96","repository_url":"https://api.github.com/repos/feathersjs/feathers-rest","labels_url":"https://api.github.com/repos/feathersjs/feathers-rest/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/feathersjs/feathers-rest/issues/96/comments","events_url":"https://api.github.com/repos/feathersjs/feathers-rest/issues/96/events","html_url":"https://github.com/feathersjs/feathers-rest/pull/96","id":197636602,"number":96,"title":"Fix missing headers and cookies make jwt could not verify","user":{"login":"immanuel192","id":5432400,"avatar_url":"https://avatars.githubusercontent.com/u/5432400?v=3","gravatar_id":"","url":"https://api.github.com/users/immanuel192","html_url":"https://github.com/immanuel192","followers_url":"https://api.github.com/users/immanuel192/followers","following_url":"https://api.github.com/users/immanuel192/following{/other_user}","gists_url":"https://api.github.com/users/immanuel192/gists{/gist_id}","starred_url":"https://api.github.com/users/immanuel192/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immanuel192/subscriptions","organizations_url":"https://api.github.com/users/immanuel192/orgs","repos_url":"https://api.github.com/users/immanuel192/repos","events_url":"https://api.github.com/users/immanuel192/events{/privacy}","received_events_url":"https://api.github.com/users/immanuel192/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-27T02:41:03Z","updated_at":"2016-12-31T09:05:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/feathersjs/feathers-rest/pulls/96","html_url":"https://github.com/feathersjs/feathers-rest/pull/96","diff_url":"https://github.com/feathersjs/feathers-rest/pull/96.diff","patch_url":"https://github.com/feathersjs/feathers-rest/pull/96.patch"},"body":"Hello\r\n\r\nWhen using the latest version of feathers-authentication, feathers-authentication-local, feathers-rest, I found one issue that feathers-rest did wrongly when exposing the req object. Because of that missing, feathers-authentication > authenticate hook could not verify token jwt.\r\n\r\n### Summary\r\nCheck this file [https://github.com/feathersjs/feathers-authentication/blob/master/src/hooks/authenticate.js](The authenticate hook)\r\n\r\nWe have this code\r\n```javascript\r\n// NOTE (EK): Passport expects an express/connect\r\n    // like request object. So we need to create on.\r\n    let request = {\r\n      query: hook.data,\r\n      body: hook.data,\r\n      params: hook.params,\r\n      headers: hook.params.headers || {},\r\n      cookies: hook.params.cookies || {},\r\n      session: {}\r\n    };\r\n```\r\n\r\nBut in our wrapper.js file, we only do:\r\n```javascript\r\n// Grab the service parameters. Use req.feathers and set the query to req.query\r\n    params = Object.assign({ query: req.query || {} }, params, req.feathers);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/feathersjs/feathers-rest/issues/comments/269856552","html_url":"https://github.com/feathersjs/feathers-rest/pull/96#issuecomment-269856552","issue_url":"https://api.github.com/repos/feathersjs/feathers-rest/issues/96","id":269856552,"user":{"login":"immanuel192","id":5432400,"avatar_url":"https://avatars.githubusercontent.com/u/5432400?v=3","gravatar_id":"","url":"https://api.github.com/users/immanuel192","html_url":"https://github.com/immanuel192","followers_url":"https://api.github.com/users/immanuel192/followers","following_url":"https://api.github.com/users/immanuel192/following{/other_user}","gists_url":"https://api.github.com/users/immanuel192/gists{/gist_id}","starred_url":"https://api.github.com/users/immanuel192/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immanuel192/subscriptions","organizations_url":"https://api.github.com/users/immanuel192/orgs","repos_url":"https://api.github.com/users/immanuel192/repos","events_url":"https://api.github.com/users/immanuel192/events{/privacy}","received_events_url":"https://api.github.com/users/immanuel192/received_events","type":"User","site_admin":false},"created_at":"2016-12-31T09:05:24Z","updated_at":"2016-12-31T09:05:24Z","body":"Sorry @daffl , there is no way to inject the required parameters into hooks data object. Please kindly check again that:\r\n- The hooks data object is created before \"before\" hooks invoked\r\n- Middlewares dont have any roles to play in this game\r\n\r\nHere is my setting up\r\n\r\n```javascript\r\nconst authentication = require('feathers-authentication');\r\nconst local = require('feathers-authentication-local');\r\nconst permissions = require('feathers-permissions');\r\n{\r\n before: {\r\n            all: [\r\n            ],\r\n            find: [\r\n                authentication.hooks.authenticate('jwt'),\r\n                permissions.hooks.checkPermissions({ service: 'users' }),\r\n                permissions.hooks.isPermitted()\r\n            ],\r\n            get: [\r\n                authentication.hooks.authenticate('jwt'),\r\n                permissions.hooks.checkPermissions({ service: 'users' }),\r\n                permissions.hooks.isPermitted()\r\n            ]\r\n}\r\n}\r\n```\r\n\r\nYou see that when 'authentication.hooks.authenticate' is executing, we can not control what will be passed into input 'hook'\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"immanuel192"}}