{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/issues/19","repository_url":"https://api.github.com/repos/strongloop/loopback-component-oauth2","labels_url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/issues/19/comments","events_url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/issues/19/events","html_url":"https://github.com/strongloop/loopback-component-oauth2/issues/19","id":60358683,"number":19,"title":"dataSource.idName null","user":{"login":"KCypher13","id":6605416,"avatar_url":"https://avatars.githubusercontent.com/u/6605416?v=3","gravatar_id":"","url":"https://api.github.com/users/KCypher13","html_url":"https://github.com/KCypher13","followers_url":"https://api.github.com/users/KCypher13/followers","following_url":"https://api.github.com/users/KCypher13/following{/other_user}","gists_url":"https://api.github.com/users/KCypher13/gists{/gist_id}","starred_url":"https://api.github.com/users/KCypher13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KCypher13/subscriptions","organizations_url":"https://api.github.com/users/KCypher13/orgs","repos_url":"https://api.github.com/users/KCypher13/repos","events_url":"https://api.github.com/users/KCypher13/events{/privacy}","received_events_url":"https://api.github.com/users/KCypher13/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/labels/triage","name":"triage","color":"eb6420"},{"url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/labels/waiting","name":"waiting","color":"eeeeee"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2015-03-09T15:18:45Z","updated_at":"2016-09-16T17:32:39Z","closed_at":null,"body":"Hi guys,\r\n\r\nI've tried to install oauth2 component on a fresh install of loopback and I got this error : \r\n\r\n````\r\n/home/rlocal/pm3-auth/node_modules/loopback-datasource-juggler/lib/relation-definition.js:1137\r\n    idName = modelTo.dataSource.idName(modelTo.modelName) || 'id';\r\n                                ^\r\nTypeError: Cannot call method 'idName' of null\r\n    at Function.RelationDefinition.belongsTo (/home/rlocal/pm3-auth/node_modules/loopback-datasource-juggler/lib/relation-definition.js:1137:33)\r\n    at Function.RelationMixin.belongsTo (/home/rlocal/pm3-auth/node_modules/loopback-datasource-juggler/lib/relations.js:123:29)\r\n    at module.exports (/home/rlocal/pm3-auth/node_modules/loopback-component-oauth2/lib/models/index.js:26:19)\r\n    at Function.module.exports (/home/rlocal/pm3-auth/node_modules/loopback-component-oauth2/lib/oauth2-loopback.js:201:16)\r\n    at /home/rlocal/pm3-auth/server/server.js:30:8\r\n    at /home/rlocal/pm3-auth/node_modules/loopback-boot/lib/executor.js:53:7\r\n    at /home/rlocal/pm3-auth/node_modules/loopback-boot/node_modules/async/lib/async.js:254:17\r\n    at /home/rlocal/pm3-auth/node_modules/loopback-boot/node_modules/async/lib/async.js:157:25\r\n    at /home/rlocal/pm3-auth/node_modules/loopback-boot/node_modules/async/lib/async.js:251:21\r\n    at /home/rlocal/pm3-auth/node_modules/loopback-boot/node_modules/async/lib/async.js:615:34\r\n````\r\n\r\nI just add the following code in the callback of boot in server.js (+require at the begining):\r\n````\r\n  var options = { \r\n  dataSource: app.dataSources.db, // Data source for oAuth2 metadata persistence\r\n  loginPage: '/login', // The login page url\r\n  loginPath: '/login' // The login form processing url\r\n};\r\n\r\noauth2.oAuth2Provider(\r\n  app, // The app instance\r\n  options // The options\r\n);\r\n`````\r\n\r\nAny idea ?\r\n\r\nThanks in advance"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/issues/comments/247660136","html_url":"https://github.com/strongloop/loopback-component-oauth2/issues/19#issuecomment-247660136","issue_url":"https://api.github.com/repos/strongloop/loopback-component-oauth2/issues/19","id":247660136,"user":{"login":"richardpringle","id":3286504,"avatar_url":"https://avatars.githubusercontent.com/u/3286504?v=3","gravatar_id":"","url":"https://api.github.com/users/richardpringle","html_url":"https://github.com/richardpringle","followers_url":"https://api.github.com/users/richardpringle/followers","following_url":"https://api.github.com/users/richardpringle/following{/other_user}","gists_url":"https://api.github.com/users/richardpringle/gists{/gist_id}","starred_url":"https://api.github.com/users/richardpringle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardpringle/subscriptions","organizations_url":"https://api.github.com/users/richardpringle/orgs","repos_url":"https://api.github.com/users/richardpringle/repos","events_url":"https://api.github.com/users/richardpringle/events{/privacy}","received_events_url":"https://api.github.com/users/richardpringle/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T17:32:38Z","updated_at":"2016-09-16T17:32:38Z","body":"Hey @Samox, best thing to do is to fork [the loopback-sandbox](https://github.com/strongloop/loopback-sandbox) and reproduce the issue in there so that I can clone and take a look myself.\r\n\r\nI'll re-open the issue for now since you are still running into it."}}
{"actor":{"display_login":"richardpringle"}}