{"action":"opened","issue":{"url":"https://api.github.com/repos/oauthjs/node-oauth2-server/issues/351","repository_url":"https://api.github.com/repos/oauthjs/node-oauth2-server","labels_url":"https://api.github.com/repos/oauthjs/node-oauth2-server/issues/351/labels{/name}","comments_url":"https://api.github.com/repos/oauthjs/node-oauth2-server/issues/351/comments","events_url":"https://api.github.com/repos/oauthjs/node-oauth2-server/issues/351/events","html_url":"https://github.com/oauthjs/node-oauth2-server/issues/351","id":192555308,"number":351,"title":"Example model fails to work","user":{"login":"alexellis","id":6358735,"avatar_url":"https://avatars.githubusercontent.com/u/6358735?v=3","gravatar_id":"","url":"https://api.github.com/users/alexellis","html_url":"https://github.com/alexellis","followers_url":"https://api.github.com/users/alexellis/followers","following_url":"https://api.github.com/users/alexellis/following{/other_user}","gists_url":"https://api.github.com/users/alexellis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexellis/subscriptions","organizations_url":"https://api.github.com/users/alexellis/orgs","repos_url":"https://api.github.com/users/alexellis/repos","events_url":"https://api.github.com/users/alexellis/events{/privacy}","received_events_url":"https://api.github.com/users/alexellis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-30T12:38:22Z","updated_at":"2016-11-30T12:38:22Z","closed_at":null,"body":"Example model at https://github.com/oauthjs/node-oauth2-server/wiki/Model-specification fails to work with Node 6.x. Please double-check.\r\n\r\n```\r\noauth alex$ node index.js \r\n/Users/alex/dev/alexa-secretkeeper/oauth/node_modules/oauth2-server/lib/server.js:24\r\n  this.options = options;\r\n               ^\r\n\r\nTypeError: Cannot set property 'options' of undefined\r\n    at OAuth2Server (/Users/alex/dev/alexa-secretkeeper/oauth/node_modules/oauth2-server/lib/server.js:24:16)\r\n    at Object.<anonymous> (/Users/alex/dev/alexa-secretkeeper/oauth/index.js:31:12)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.runMain (module.js:604:10)\r\n    at run (bootstrap_node.js:394:7)\r\n    at startup (bootstrap_node.js:149:9)\r\n    at bootstrap_node.js:509:3\r\n```\r\n\r\nComplete example:\r\n\r\n```\r\n\"use strict\"\r\n\r\nvar model = {\r\n  // We support generators.\r\n  getAccessToken: function () {\r\n      \r\n    return 'works!'\r\n  },\r\n\r\n  // Or, async/await (using _babel_).\r\n  getAuthorizationCode: function() {\r\n    return 'works';\r\n  },\r\n\r\n  // Or, calling a node-style callback.\r\n  getClient: function(done) {\r\n\r\n    done(null, 'works!');\r\n  },\r\n\r\n  // Or, returning a promise.\r\n  getUser: function() {\r\n    return new Promise('works!');\r\n  },\r\n};\r\n\r\nlet express = require(\"express\")\r\nvar app = express();\r\nvar options = { model: model };\r\nvar oauth2server = require('oauth2-server')\r\nlet oauth= oauth2server(options);\r\n\r\napp.use(oauth.authenticate());\r\n\r\napp.get('/', function (req, res) {\r\n  res.send('Hello World');\r\n})\r\n\r\napp.listen(3000);\r\n```"}}
{"actor":{"display_login":"alexellis"}}