简体   繁体   中英

Using passport.js with DynamoDB

I am new to node.js and I have made some simple static pages using ejs, and just recently began storing and retrieving data with DynamoDB on AWS. Now, I want to make a simple user authentication app using passport for signup, login, and logout.

I found the following: https://github.com/christianboutin/passportjs-dynamodb

However, I'm not sure how to implement. II think i would add something like the following in my routes.js file:

router.post('/signup', passport.authenticate('local-signup', {
    successRedirect : '/index',
    failureRedirect : '/signup1', 
    failureFlash : true 
}));

Is this the right approach? Would I just include the passport.js file from the git repository in the routes.js file to achieve this?

Install passport-local via npm or yarn, then just copy/paste the code from passport-dynamodb passport.js as you said to your existing project repo. passport-dynamodb is not published to npm, which is why you cannot install and import it as you normally would a nodeJS package like passport itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM