fgsants / REST-API-FreeRADIUS

A simple REST Server for the FreeRADIUS rlm_rest module
GNU General Public License v3.0
115 stars 51 forks source link

Not able to Authenticate User after creating it in MongoDB #6

Open gwalashish opened 4 years ago

gwalashish commented 4 years ago

I was able to create a new user using DB Endpoint which was given in the Readme but while I was trying to authenticate it from REST API, it was crashing, please see below error,

events.js:174

  throw er; // Unhandled 'error' event
  ^

TypeError: Cannot read property 'status' of null at /root/Radius_3.0/REST-API-FreeRADIUS/api/controllers/radius.js:23:29 at /root/Radius_3.0/REST-API-FreeRADIUS/node_modules/mongoose/lib/model.js:4837:16 at /root/Radius_3.0/REST-API-FreeRADIUS/node_modules/mongoose/lib/helpers/promiseOrCallback.js:24:16 at /root/Radius_3.0/REST-API-FreeRADIUS/node_modules/mongoose/lib/model.js:4860:21 at _hooks.execPost (/root/Radius_3.0/REST-API-FreeRADIUS/node_modules/mongoose/lib/query.js:4370:11) at /root/Radius_3.0/REST-API-FreeRADIUS/node_modules/kareem/index.js:135:16 at process._tickCallback (internal/process/next_tick.js:61:11) Emitted 'error' event at: at /root/Radius_3.0/REST-API-FreeRADIUS/node_modules/mongoose/lib/model.js:4839:13 at /root/Radius_3.0/REST-API-FreeRADIUS/node_modules/mongoose/lib/helpers/promiseOrCallback.js:24:16 [... lines matching original stack trace ...] at process._tickCallback (internal/process/next_tick.js:61:11) [nodemon] app crashed - waiting for file changes before starting...

Please let me know where I was going wrong or which steps should I follow to get desired results. Awaiting for your reply.

deweydb commented 4 years ago

You didn't create a user with a profile. You have to create a profile first, and then use that profile id when creating the user. The module should prevent this, the profile id field should be required.