{"action":"closed","number":61,"pull_request":{"url":"https://api.github.com/repos/auth0/express-jwt/pulls/61","id":30976609,"html_url":"https://github.com/auth0/express-jwt/pull/61","diff_url":"https://github.com/auth0/express-jwt/pull/61.diff","patch_url":"https://github.com/auth0/express-jwt/pull/61.patch","issue_url":"https://api.github.com/repos/auth0/express-jwt/issues/61","number":61,"state":"closed","locked":false,"title":"Fix for 'Buffer' secret with new multitenancy callback ","user":{"login":"dwmkerr","id":1926984,"avatar_url":"https://avatars.githubusercontent.com/u/1926984?v=3","gravatar_id":"","url":"https://api.github.com/users/dwmkerr","html_url":"https://github.com/dwmkerr","followers_url":"https://api.github.com/users/dwmkerr/followers","following_url":"https://api.github.com/users/dwmkerr/following{/other_user}","gists_url":"https://api.github.com/users/dwmkerr/gists{/gist_id}","starred_url":"https://api.github.com/users/dwmkerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwmkerr/subscriptions","organizations_url":"https://api.github.com/users/dwmkerr/orgs","repos_url":"https://api.github.com/users/dwmkerr/repos","events_url":"https://api.github.com/users/dwmkerr/events{/privacy}","received_events_url":"https://api.github.com/users/dwmkerr/received_events","type":"User","site_admin":false},"body":"It appears that since the new multitenancy callback features have gone in, you cannot use the middleware if you provide a secret in the form of a `Buffer`.\r\n\r\nThis is due to the fact that the code is checking to see if the `secret` is static by checking if it is a string. If so, it is wrapped in a callback function. This is fine unless your `secret` is a `Buffer` in which case it must also be wrapped.\r\n\r\nThis PR also contains a test which demonstrates the bug (although the test passes because this PR fixes the bug).\r\n\r\nThe fix is to check to see if the `secret` is a string OR a buffer. Perhaps a better solution is to check to see if `secret` is a callback.\r\n\r\nThe error you will see is of the form:\r\n\r\n```\r\nTypeError: object is not a function\r\n    at async.parallel.revoked (c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modul\r\nes\\express-jwt\\lib\\index.js:84:9)\r\n    at c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-jwt\\node_modu\r\nles\\async\\lib\\async.js:570:21\r\n    at c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-jwt\\node_modu\r\nles\\async\\lib\\async.js:249:17\r\n    at c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-jwt\\node_modu\r\nles\\async\\lib\\async.js:125:13\r\n    at Array.forEach (native)\r\n    at _each (c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-jwt\\no\r\nde_modules\\async\\lib\\async.js:46:24)\r\n    at async.each (c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-j\r\nwt\\node_modules\\async\\lib\\async.js:124:9)\r\n    at _asyncMap (c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-jw\r\nt\\node_modules\\async\\lib\\async.js:248:13)\r\n    at Object.map (c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-j\r\nwt\\node_modules\\async\\lib\\async.js:219:23)\r\n    at _parallel (c:\\Repositories\\GitHub\\dwmkerr\\onedown\\node_modules\\express-jw\r\nt\\node_modules\\async\\lib\\async.js:568:20)\r\n```\r\n\r\nThis is perhaps quite an important issue as if you follow the Auth0 guide for setting up a new NodeJS / SPA project then the code generated in the tutorial uses a `Buffer` for a secret, meaning following the tutorial leads to a failing application.","created_at":"2015-03-11T19:26:13Z","updated_at":"2015-03-11T19:59:04Z","closed_at":"2015-03-11T19:59:04Z","merged_at":"2015-03-11T19:59:04Z","merge_commit_sha":"4893d02c2b587af30d901ce5782a83e2fb0a6ee1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/auth0/express-jwt/pulls/61/commits","review_comments_url":"https://api.github.com/repos/auth0/express-jwt/pulls/61/comments","review_comment_url":"https://api.github.com/repos/auth0/express-jwt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/auth0/express-jwt/issues/61/comments","statuses_url":"https://api.github.com/repos/auth0/express-jwt/statuses/5a28821c0363b1d9d9ac558b1cc8fb13e1f97cb7","head":{"label":"dwmkerr:master","ref":"master","sha":"5a28821c0363b1d9d9ac558b1cc8fb13e1f97cb7","user":{"login":"dwmkerr","id":1926984,"avatar_url":"https://avatars.githubusercontent.com/u/1926984?v=3","gravatar_id":"","url":"https://api.github.com/users/dwmkerr","html_url":"https://github.com/dwmkerr","followers_url":"https://api.github.com/users/dwmkerr/followers","following_url":"https://api.github.com/users/dwmkerr/following{/other_user}","gists_url":"https://api.github.com/users/dwmkerr/gists{/gist_id}","starred_url":"https://api.github.com/users/dwmkerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwmkerr/subscriptions","organizations_url":"https://api.github.com/users/dwmkerr/orgs","repos_url":"https://api.github.com/users/dwmkerr/repos","events_url":"https://api.github.com/users/dwmkerr/events{/privacy}","received_events_url":"https://api.github.com/users/dwmkerr/received_events","type":"User","site_admin":false},"repo":{"id":32035847,"name":"express-jwt","full_name":"dwmkerr/express-jwt","owner":{"login":"dwmkerr","id":1926984,"avatar_url":"https://avatars.githubusercontent.com/u/1926984?v=3","gravatar_id":"","url":"https://api.github.com/users/dwmkerr","html_url":"https://github.com/dwmkerr","followers_url":"https://api.github.com/users/dwmkerr/followers","following_url":"https://api.github.com/users/dwmkerr/following{/other_user}","gists_url":"https://api.github.com/users/dwmkerr/gists{/gist_id}","starred_url":"https://api.github.com/users/dwmkerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwmkerr/subscriptions","organizations_url":"https://api.github.com/users/dwmkerr/orgs","repos_url":"https://api.github.com/users/dwmkerr/repos","events_url":"https://api.github.com/users/dwmkerr/events{/privacy}","received_events_url":"https://api.github.com/users/dwmkerr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dwmkerr/express-jwt","description":"connect/express middleware that validates a JsonWebToken (JWT) and set the req.user with the attributes","fork":true,"url":"https://api.github.com/repos/dwmkerr/express-jwt","forks_url":"https://api.github.com/repos/dwmkerr/express-jwt/forks","keys_url":"https://api.github.com/repos/dwmkerr/express-jwt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwmkerr/express-jwt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwmkerr/express-jwt/teams","hooks_url":"https://api.github.com/repos/dwmkerr/express-jwt/hooks","issue_events_url":"https://api.github.com/repos/dwmkerr/express-jwt/issues/events{/number}","events_url":"https://api.github.com/repos/dwmkerr/express-jwt/events","assignees_url":"https://api.github.com/repos/dwmkerr/express-jwt/assignees{/user}","branches_url":"https://api.github.com/repos/dwmkerr/express-jwt/branches{/branch}","tags_url":"https://api.github.com/repos/dwmkerr/express-jwt/tags","blobs_url":"https://api.github.com/repos/dwmkerr/express-jwt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwmkerr/express-jwt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwmkerr/express-jwt/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwmkerr/express-jwt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwmkerr/express-jwt/statuses/{sha}","languages_url":"https://api.github.com/repos/dwmkerr/express-jwt/languages","stargazers_url":"https://api.github.com/repos/dwmkerr/express-jwt/stargazers","contributors_url":"https://api.github.com/repos/dwmkerr/express-jwt/contributors","subscribers_url":"https://api.github.com/repos/dwmkerr/express-jwt/subscribers","subscription_url":"https://api.github.com/repos/dwmkerr/express-jwt/subscription","commits_url":"https://api.github.com/repos/dwmkerr/express-jwt/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwmkerr/express-jwt/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwmkerr/express-jwt/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwmkerr/express-jwt/issues/comments{/number}","contents_url":"https://api.github.com/repos/dwmkerr/express-jwt/contents/{+path}","compare_url":"https://api.github.com/repos/dwmkerr/express-jwt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwmkerr/express-jwt/merges","archive_url":"https://api.github.com/repos/dwmkerr/express-jwt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwmkerr/express-jwt/downloads","issues_url":"https://api.github.com/repos/dwmkerr/express-jwt/issues{/number}","pulls_url":"https://api.github.com/repos/dwmkerr/express-jwt/pulls{/number}","milestones_url":"https://api.github.com/repos/dwmkerr/express-jwt/milestones{/number}","notifications_url":"https://api.github.com/repos/dwmkerr/express-jwt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwmkerr/express-jwt/labels{/name}","releases_url":"https://api.github.com/repos/dwmkerr/express-jwt/releases{/id}","created_at":"2015-03-11T19:04:59Z","updated_at":"2015-03-11T19:51:49Z","pushed_at":"2015-03-11T19:51:49Z","git_url":"git://github.com/dwmkerr/express-jwt.git","ssh_url":"git@github.com:dwmkerr/express-jwt.git","clone_url":"https://github.com/dwmkerr/express-jwt.git","svn_url":"https://github.com/dwmkerr/express-jwt","homepage":null,"size":538,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"auth0:master","ref":"master","sha":"b183ffc69185adba4fe85ecdc44483a995f2d216","user":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=3","gravatar_id":"","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"repo":{"id":13783958,"name":"express-jwt","full_name":"auth0/express-jwt","owner":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=3","gravatar_id":"","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/auth0/express-jwt","description":"connect/express middleware that validates a JsonWebToken (JWT) and set the req.user with the attributes","fork":false,"url":"https://api.github.com/repos/auth0/express-jwt","forks_url":"https://api.github.com/repos/auth0/express-jwt/forks","keys_url":"https://api.github.com/repos/auth0/express-jwt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auth0/express-jwt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auth0/express-jwt/teams","hooks_url":"https://api.github.com/repos/auth0/express-jwt/hooks","issue_events_url":"https://api.github.com/repos/auth0/express-jwt/issues/events{/number}","events_url":"https://api.github.com/repos/auth0/express-jwt/events","assignees_url":"https://api.github.com/repos/auth0/express-jwt/assignees{/user}","branches_url":"https://api.github.com/repos/auth0/express-jwt/branches{/branch}","tags_url":"https://api.github.com/repos/auth0/express-jwt/tags","blobs_url":"https://api.github.com/repos/auth0/express-jwt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auth0/express-jwt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auth0/express-jwt/git/refs{/sha}","trees_url":"https://api.github.com/repos/auth0/express-jwt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auth0/express-jwt/statuses/{sha}","languages_url":"https://api.github.com/repos/auth0/express-jwt/languages","stargazers_url":"https://api.github.com/repos/auth0/express-jwt/stargazers","contributors_url":"https://api.github.com/repos/auth0/express-jwt/contributors","subscribers_url":"https://api.github.com/repos/auth0/express-jwt/subscribers","subscription_url":"https://api.github.com/repos/auth0/express-jwt/subscription","commits_url":"https://api.github.com/repos/auth0/express-jwt/commits{/sha}","git_commits_url":"https://api.github.com/repos/auth0/express-jwt/git/commits{/sha}","comments_url":"https://api.github.com/repos/auth0/express-jwt/comments{/number}","issue_comment_url":"https://api.github.com/repos/auth0/express-jwt/issues/comments{/number}","contents_url":"https://api.github.com/repos/auth0/express-jwt/contents/{+path}","compare_url":"https://api.github.com/repos/auth0/express-jwt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auth0/express-jwt/merges","archive_url":"https://api.github.com/repos/auth0/express-jwt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auth0/express-jwt/downloads","issues_url":"https://api.github.com/repos/auth0/express-jwt/issues{/number}","pulls_url":"https://api.github.com/repos/auth0/express-jwt/pulls{/number}","milestones_url":"https://api.github.com/repos/auth0/express-jwt/milestones{/number}","notifications_url":"https://api.github.com/repos/auth0/express-jwt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auth0/express-jwt/labels{/name}","releases_url":"https://api.github.com/repos/auth0/express-jwt/releases{/id}","created_at":"2013-10-22T19:45:55Z","updated_at":"2015-03-11T19:59:04Z","pushed_at":"2015-03-11T19:59:04Z","git_url":"git://github.com/auth0/express-jwt.git","ssh_url":"git@github.com:auth0/express-jwt.git","clone_url":"https://github.com/auth0/express-jwt.git","svn_url":"https://github.com/auth0/express-jwt","homepage":null,"size":538,"stargazers_count":265,"watchers_count":265,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":63,"mirror_url":null,"open_issues_count":4,"forks":63,"open_issues":4,"watchers":265,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/auth0/express-jwt/pulls/61"},"html":{"href":"https://github.com/auth0/express-jwt/pull/61"},"issue":{"href":"https://api.github.com/repos/auth0/express-jwt/issues/61"},"comments":{"href":"https://api.github.com/repos/auth0/express-jwt/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/auth0/express-jwt/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/auth0/express-jwt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/auth0/express-jwt/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/auth0/express-jwt/statuses/5a28821c0363b1d9d9ac558b1cc8fb13e1f97cb7"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"dschenkelman","id":3376731,"avatar_url":"https://avatars.githubusercontent.com/u/3376731?v=3","gravatar_id":"","url":"https://api.github.com/users/dschenkelman","html_url":"https://github.com/dschenkelman","followers_url":"https://api.github.com/users/dschenkelman/followers","following_url":"https://api.github.com/users/dschenkelman/following{/other_user}","gists_url":"https://api.github.com/users/dschenkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/dschenkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dschenkelman/subscriptions","organizations_url":"https://api.github.com/users/dschenkelman/orgs","repos_url":"https://api.github.com/users/dschenkelman/repos","events_url":"https://api.github.com/users/dschenkelman/events{/privacy}","received_events_url":"https://api.github.com/users/dschenkelman/received_events","type":"User","site_admin":false},"comments":4,"review_comments":0,"commits":3,"additions":17,"deletions":1,"changed_files":2}}