Wednesday, 3 April 2019

Passport js with node and react

How to do authentication with node and react using passport.js. I'm asking this because I'm sort of confused when I look at the docs, I have come to think it's because I don't fully understand how decoupled frontend and backend work. I see snippets like these in the docs,app.post('/login', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' }));Where the nodejs app redirects to different routes, aren't these applicable when nodejs has views and hence can redirect? Or SSR react also maybe not sure. But if it's totally client side rendered react app which just sends and receives data through an API, are those built in a way it support these types of redirects as well?Or is passport used differently there?Can you people kindly clarify me on this one and hopefully point out a tutorial that uses passport with node and react the right way, normal jwt and basic oauth with something else, but I guess one will do make me understand. Thank you.

Submitted April 03, 2019 at 11:10PM by sum__sleples

No comments:

Post a Comment