{"action":"created","issue":{"url":"https://api.github.com/repos/websockets/ws/issues/929","repository_url":"https://api.github.com/repos/websockets/ws","labels_url":"https://api.github.com/repos/websockets/ws/issues/929/labels{/name}","comments_url":"https://api.github.com/repos/websockets/ws/issues/929/comments","events_url":"https://api.github.com/repos/websockets/ws/issues/929/events","html_url":"https://github.com/websockets/ws/issues/929","id":194546490,"number":929,"title":"How to authenticate a client via token using verifyClient?","user":{"login":"subwaystation","id":10184961,"avatar_url":"https://avatars.githubusercontent.com/u/10184961?v=3","gravatar_id":"","url":"https://api.github.com/users/subwaystation","html_url":"https://github.com/subwaystation","followers_url":"https://api.github.com/users/subwaystation/followers","following_url":"https://api.github.com/users/subwaystation/following{/other_user}","gists_url":"https://api.github.com/users/subwaystation/gists{/gist_id}","starred_url":"https://api.github.com/users/subwaystation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subwaystation/subscriptions","organizations_url":"https://api.github.com/users/subwaystation/orgs","repos_url":"https://api.github.com/users/subwaystation/repos","events_url":"https://api.github.com/users/subwaystation/events{/privacy}","received_events_url":"https://api.github.com/users/subwaystation/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-12-09T09:11:53Z","updated_at":"2016-12-09T15:03:18Z","closed_at":"2016-12-09T14:53:26Z","body":"Currently I am trying to implement a way so that a client who wants to connect to the `websocket` has to be authenticated first. Mainly,  I wanted to reproduce this example: [http://iostreamer.me/ws/node.js/jwt/2016/05/08/websockets_authentication.html](url)\r\nHowever, the `websocket` specifications [https://html.spec.whatwg.org/multipage/comms.html#network](url) state that the only arguments allowed on the client side are `url` and `protocol`. Furthermore, the `ws` module won't be available on the client side. I tried `browserify`, but this does not work. Now I am wondering how an secure client authentication using `tokens` and `verifyClient` is possible with `ws`?\r\nA server and client side example would be awesome.\r\n\r\nAn additional question I have:\r\n```javascript\r\nwss.on('connection', function connection(ws) {\r\n  var location = url.parse(ws.upgradeReq.url, true);\r\n  console.log(location);\r\n}\r\n```\r\nGives me:\r\n```javascript\r\nUrl {\r\n  protocol: null,\r\n  slashes: null,\r\n  auth: null,\r\n  host: null,\r\n  port: null,\r\n  hostname: null,\r\n  hash: null,\r\n  search: '',\r\n  query: {},\r\n  pathname: '/',\r\n  path: '/',\r\n  href: '/' \r\n}\r\n```\r\nHow can I set all these fields on the client side?\r\n\r\nI also stumbled across [websockets.github.io/ws/](url). Though here the `websocket` handshake already took place before the authentication process. Furthermore, a client would still be able to send stuff not containing the `authentication` header which then would not have to be authenticated. Or am I getting something wrong?\r\n\r\nAny help would be appreciated.\r\nAll the best."},"comment":{"url":"https://api.github.com/repos/websockets/ws/issues/comments/266034567","html_url":"https://github.com/websockets/ws/issues/929#issuecomment-266034567","issue_url":"https://api.github.com/repos/websockets/ws/issues/929","id":266034567,"user":{"login":"lucj","id":182406,"avatar_url":"https://avatars.githubusercontent.com/u/182406?v=3","gravatar_id":"","url":"https://api.github.com/users/lucj","html_url":"https://github.com/lucj","followers_url":"https://api.github.com/users/lucj/followers","following_url":"https://api.github.com/users/lucj/following{/other_user}","gists_url":"https://api.github.com/users/lucj/gists{/gist_id}","starred_url":"https://api.github.com/users/lucj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucj/subscriptions","organizations_url":"https://api.github.com/users/lucj/orgs","repos_url":"https://api.github.com/users/lucj/repos","events_url":"https://api.github.com/users/lucj/events{/privacy}","received_events_url":"https://api.github.com/users/lucj/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T15:03:18Z","updated_at":"2016-12-09T15:03:18Z","body":"@lpinca I'm sure this will work, and is more elegant than performing twice the same call :)\r\nThanks, I'll try this approach."}}
{"actor":{"display_login":"lucj"}}