Composer-rest-server with passport-local strategy

*爱你&永不变心* 提交于 2019-12-02 07:57:16

问题


I am not able to find a working solution to authenticate using local strategy in composer-rest-server. In fact only one working solution is using github. I tried setting up the COMPOSER_PROVIDERS as

export COMPOSER_PROVIDERS='{
  "local": { 
    "provider": "local", 
    "module": "passport-local", 
    "usernameField": "username", 
    "passwordField": "password", 
    "authPath": "/auth/local", 
    "callbackURL":"/auth/local/callback",
    "successRedirect": "/", 
    "failureRedirect": "/", 
    "setAccessToken": true, 
    "callbackHTTPMethod": "post" 
   }
}'

but no luck. I am not even getting a login form for this. for localhost:3000/auth/local , I am getting 404. Looks like no one has tried local authentication strategy till now. I am new to nodejs programming. Any help is highly appreciated.


回答1:


Others may post a solution, but you may wish to refer to these links: Where to put PassportJs local strategy in an express application? and https://github.com/strongloop/loopback-example-passport/issues/99 and How to use passport-local to authenticate in composer rest server




回答2:


Solved this by changing the callback function to default one in passport-configurator.js



来源:https://stackoverflow.com/questions/50349925/composer-rest-server-with-passport-local-strategy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!