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 )?
I wanted to do that also initially, but then I just edit the server.js file on the composer rest server for basic auth at the end.
It is possible to customize your composer-rest-server, based on the loopback framework, according to your requirements.
I suggest to read this tutorial from the official documentation.
https://hyperledger.github.io/composer/latest/integrating/customizing-the-rest-server