How to use passport-local to authenticate in composer rest server

Viewed 1987

I want to use passport-local to authenticate user to login into composer rest server like other passport strategies ( e.g passport-github,passport-google).

So first I try to set COMPOSER_PROVIDER variable like this

"local": {
    "provider": "local",
    "module": "passport-local",
    "usernameField": "username",
    "passwordField": "password",
    "authPath": "/auth/local",
    "successRedirect": "/",
    "failureRedirect": "/"}

Then i run the server in docker (with mongo as persisted datasource) and add some user in database collection

The question is what's next step that i need to use this passport.Because i run this command and still get response with 401 Unauthorized

curl -H "Content-Type: application/json" -X POST -d '{"username":"{USER_NAME}","password":"{USER_PASSWORD}"}' http://localhost:3000/auth/local

Is it not enough to use this passport? Does i need to start another service to locally authenticate this login (e.g. GitHub oAuth Application )?

2 Answers
Related