Search code examples
meanjs

rest api post method not working for basic auth in meanjs 0.5.0


I tried to check post method of meanjs (0.5.0) in postman with basic auth but it doesn't seem to be working. I am giving the correct credentials.

It show below error:

{ "message": "User is not authorized" }

Any idea what can be done?


Solution

  • I found in ./node_modules/passport-local/lib/strategy.js that _usernameField name is usernameOrEmail instead of username.

    So I passed below json object with content header as "application/json" from postman and it got connected successfully:

    {
       "usernameOrEmail":"test",
       "password":"test"
    }