Tuesday 16 May 2017

How can I authenticate users with server-side data with Passport.js

In passport.js, you would normally sign a user up using post data from one of your routes and it would look something like this:

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

But let's say all of the user data is already on the server, in an array. How can I sign the user up using passport without having to get the data with GET or POST, since the data is already on the server?

To specify why, I'm using express, socket.io, and passport.js, and the reason I can't have a traditional signup form that does all the work for you is because I'm pulling the majority of the user data from an API, and it would not be secure if I were to send this data to the client and then post it. All help is appreciated, thank you! :)



via Aris

No comments:

Post a Comment