nodes passport Error: Unknown authentication strategy “local-login”

后端 未结 2 1526
别跟我提以往
别跟我提以往 2021-01-14 19:22

I have been trying to get local authentication work with passport on nodejs and as far as i can tell all of my code it is correct but i keep getting the same annoying error

2条回答
  •  忘掉有多难
    2021-01-14 20:19

    require('./config/passport')(passport);
    

    Change the path of the file. Without this working, passport's configurations will not be passed to the routes.

    Here is a snippet of where the line should be located:

    // server.js
    
    // configuration
    ===============================================================
    mongoose.connect(configDB.url); // connect to our database
    
    require('./config/passport')(passport); // pass passport for configuration
    

提交回复
热议问题