{"action":"created","issue":{"url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/226","repository_url":"https://api.github.com/repos/auth0/node-jsonwebtoken","labels_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/226/labels{/name}","comments_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/226/comments","events_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/226/events","html_url":"https://github.com/auth0/node-jsonwebtoken/issues/226","id":164596248,"number":226,"title":"err == JWT, token == undefined in async sign?","user":{"login":"r3wt","id":4483325,"avatar_url":"https://avatars.githubusercontent.com/u/4483325?v=3","gravatar_id":"","url":"https://api.github.com/users/r3wt","html_url":"https://github.com/r3wt","followers_url":"https://api.github.com/users/r3wt/followers","following_url":"https://api.github.com/users/r3wt/following{/other_user}","gists_url":"https://api.github.com/users/r3wt/gists{/gist_id}","starred_url":"https://api.github.com/users/r3wt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r3wt/subscriptions","organizations_url":"https://api.github.com/users/r3wt/orgs","repos_url":"https://api.github.com/users/r3wt/repos","events_url":"https://api.github.com/users/r3wt/events{/privacy}","received_events_url":"https://api.github.com/users/r3wt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-08T19:05:58Z","updated_at":"2016-07-08T19:18:50Z","closed_at":"2016-07-08T19:18:50Z","body":"```js\r\nvar jwt = require('jsonwebtoken');\r\njwt.sign(req.user, config.jwt.secret , {\r\n\texpiresIn: '365 days',\r\n}, function (err, token) {\r\n\tlog.debug(\"err: \\n%s\\ntoken: \\n %s\",err,token);\r\n\tif (err !== null) {\r\n\t\treturn res.error(err);\r\n\t}\r\n\tres.apiResponse({\r\n\t\tid: newUser.id,\r\n\t\temail: newUser.email,\r\n\t\tisAdmin: !!newUser.admin,\r\n\t\ttoken: token,\r\n\t});\r\n});\r\n```\r\n\r\nthe call to `log.debug()` outputs:\r\n\r\n```\r\n\r\n[Fri Jul 08 2016 18:56:58 GMT+0000 (UTC)] DEBUG err:\r\neyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjU3N2ZmNzdhMDM2NGQ2MTExY2FlNTY3OCI    sImVtYWlsIjoiZ2FycmV0dEA2Yml0Y29uc3VsdGluZy5jb20iLCJpc0FkbWluIjpmYWxzZSwiZGF0ZSI    6IjIwMTYtMDctMDhUMTg6NTY6NTguNTg1WiIsIl9fc3B0IjoiZXlKMGVYQWlPaUpLVjFRaUxDSmhiR2N    pT2lKSVV6STFOaUo5LmV5SnBjM01pT2lKb2RIUndjem92TDJGd2FTNXpkRzl5YlhCaGRHZ3VZMjl0TDN    ZeEwyRndjR3hwWTJGMGFXOXVjeTgyVGt0WFdUaFFOekU1Uld4SU1YbG9ZV2RaVTBFMElpd2ljM1ZpSWp    vaWFIUjBjSE02THk5aGNHa3VjM1J2Y20xd1lYUm9MbU52YlM5Mk1TOWhZMk52ZFc1MGN5ODFiMmRJUzI    1TU1VUTRTRXB2ZUZsU1lrSXpVV1Z6SWl3aWFuUnBJam9pTXpJNU1UazBZemt0WWpVNU15MDBOREpsTFR    rell6UXRNRFEyTlRCaU9XRTVNek5rSWl3aWFXRjBJam94TkRZNE1EQTBNakU0TENKbGVIQWlPakUwTmp    nd01EYzRNVGg5LkhLalVZTTBKa0hiR242MFdQNGc0dDVkdno1c2VQWXBVMktRalZaSmJ6cGsiLCJpYXQ    iOjE0NjgwMDQyMTgsImV4cCI6MTQ5OTU0MDIxOH0.7iw_iSZ-05O1Py-nl2z7FCFbhGu63urt4_iqaeE    7DFc\r\ntoken:\r\n undefined\r\n```\r\n\r\nI'm having trouble understanding if your documentation is incorrect and the signature to the callback is actually `function(token,error)` or if some type of error occured during signing. the `req.user` object does contain a base64 encoded JWT already that comes from stormpath, so if the error is correct it could be a result of that."},"comment":{"url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/comments/231449254","html_url":"https://github.com/auth0/node-jsonwebtoken/issues/226#issuecomment-231449254","issue_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/226","id":231449254,"user":{"login":"jfromaniello","id":178512,"avatar_url":"https://avatars.githubusercontent.com/u/178512?v=3","gravatar_id":"","url":"https://api.github.com/users/jfromaniello","html_url":"https://github.com/jfromaniello","followers_url":"https://api.github.com/users/jfromaniello/followers","following_url":"https://api.github.com/users/jfromaniello/following{/other_user}","gists_url":"https://api.github.com/users/jfromaniello/gists{/gist_id}","starred_url":"https://api.github.com/users/jfromaniello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfromaniello/subscriptions","organizations_url":"https://api.github.com/users/jfromaniello/orgs","repos_url":"https://api.github.com/users/jfromaniello/repos","events_url":"https://api.github.com/users/jfromaniello/events{/privacy}","received_events_url":"https://api.github.com/users/jfromaniello/received_events","type":"User","site_admin":false},"created_at":"2016-07-08T19:18:50Z","updated_at":"2016-07-08T19:18:50Z","body":"You are using an older version. Rule of thumb with node modules, if you have this kind of doubts on an API always read the readme from your node_modules folder not from github."}}
{"actor":{"display_login":"jfromaniello"}}