{"action":"created","issue":{"url":"https://api.github.com/repos/mcollina/mosca/issues/588","repository_url":"https://api.github.com/repos/mcollina/mosca","labels_url":"https://api.github.com/repos/mcollina/mosca/issues/588/labels{/name}","comments_url":"https://api.github.com/repos/mcollina/mosca/issues/588/comments","events_url":"https://api.github.com/repos/mcollina/mosca/issues/588/events","html_url":"https://github.com/mcollina/mosca/issues/588","id":199336495,"number":588,"title":"Adding credentials.json to mosca settings","user":{"login":"bacteria323","id":11582621,"avatar_url":"https://avatars3.githubusercontent.com/u/11582621?v=4","gravatar_id":"","url":"https://api.github.com/users/bacteria323","html_url":"https://github.com/bacteria323","followers_url":"https://api.github.com/users/bacteria323/followers","following_url":"https://api.github.com/users/bacteria323/following{/other_user}","gists_url":"https://api.github.com/users/bacteria323/gists{/gist_id}","starred_url":"https://api.github.com/users/bacteria323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bacteria323/subscriptions","organizations_url":"https://api.github.com/users/bacteria323/orgs","repos_url":"https://api.github.com/users/bacteria323/repos","events_url":"https://api.github.com/users/bacteria323/events{/privacy}","received_events_url":"https://api.github.com/users/bacteria323/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-01-07T03:01:39Z","updated_at":"2018-03-22T05:26:36Z","closed_at":"2017-01-07T09:32:04Z","author_association":"NONE","body":"I am trying to add credentials.json to the mosca settings file but I am getting the error:\r\n\r\n    /home/User/Desktop/node_modules/mosca/lib/server.js:109\r\n      throw new Error(errMessage);\r\n      ^\r\n\r\n    Error: is not of a type(s) object\r\n    at EventEmitter.Server (/home/User/Desktop/node_modules/mosca/lib/server.js:109:13)\r\n    at Object.<anonymous> (/home/User/Desktop/MOSCA/mosca-app.js:50:14)\r\n    at Module._compile (module.js:410:26)\r\n    at Object.Module._extensions..js (module.js:417:10)\r\n    at Module.load (module.js:344:32)\r\n    at Function.Module._load (module.js:301:12)\r\n    at Function.Module.runMain (module.js:442:10)\r\n    at startup (node.js:136:18)\r\n    at node.js:966:3\r\n\r\n\r\nMy mosca settings is:\r\n\r\n    var moscaSettings = {\r\n      credentials: \"credentials.json\", // This line is causing the error\r\n      port: 1883,\r\n      backend: ascoltatore,\r\n      persistence: {\r\n        factory: mosca.persistence.Mongo,\r\n        url: 'mongodb://localhost:27017/mqtt'\r\n      }\r\n    };\r\n    "},"comment":{"url":"https://api.github.com/repos/mcollina/mosca/issues/comments/375184290","html_url":"https://github.com/mcollina/mosca/issues/588#issuecomment-375184290","issue_url":"https://api.github.com/repos/mcollina/mosca/issues/588","id":375184290,"user":{"login":"bigbenz8","id":8120813,"avatar_url":"https://avatars0.githubusercontent.com/u/8120813?v=4","gravatar_id":"","url":"https://api.github.com/users/bigbenz8","html_url":"https://github.com/bigbenz8","followers_url":"https://api.github.com/users/bigbenz8/followers","following_url":"https://api.github.com/users/bigbenz8/following{/other_user}","gists_url":"https://api.github.com/users/bigbenz8/gists{/gist_id}","starred_url":"https://api.github.com/users/bigbenz8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigbenz8/subscriptions","organizations_url":"https://api.github.com/users/bigbenz8/orgs","repos_url":"https://api.github.com/users/bigbenz8/repos","events_url":"https://api.github.com/users/bigbenz8/events{/privacy}","received_events_url":"https://api.github.com/users/bigbenz8/received_events","type":"User","site_admin":false},"created_at":"2018-03-22T05:26:36Z","updated_at":"2018-03-22T05:26:36Z","author_association":"NONE","body":"do not put \"credentials\" field into mosca setting, just define a setting only for userAuth, like : \r\n\r\nconst **authSetting** = {credentials: \"credentials.json\" } and pass it to setup func : \r\nfunction setup() {\r\n\t// setup authorizer\r\n\tloadAuthorizer(**authSetting**, function(err, authorizer) {\r\n\t    if (err) {\r\n\t\t    // handle error here\r\n\t    }\r\n\r\n\t    if (authorizer) {\r\n\t\t    server.authenticate = authorizer.authenticate;\r\n\t\t    server.authorizeSubscribe = authorizer.authorizeSubscribe;\r\n\t\t    server.authorizePublish = authorizer.authorizePublish;\r\n\t    }\r\n\t});\r\n\r\n    // you are good to go!\r\n}\r\n\r\nput the setup func in server ready call back. it will works .  Good luck.\r\n\r\nsee here:  https://github.com/mcollina/mosca/wiki/Authentication-&-Authorization\r\n\r\nUsing Mosca's standalone authorizer with an embedded Mosca"}}
{"actor":{"display_login":"bigbenz8"}}