Friday 15 June 2018

How to redirect to correct client route after authentication with Passport (react, react-router, express, passport) ?

I'm creating a webapp with NodeJS/Express as the backend and React as the frontend. For authentication I'm using passport-local strategy. I'm following this tutorial to implement it. As in the tutorial he use pug it's easy to redirect the pages as it's done via routing on the server. But as for a react app, routing is done in the client (with react-router) I find it difficult to redirect to a specific page (Component) when the authentication is done. How can I achieve that ? Is there any tutorial that I can follow and get an understanding about this ?

Submitted June 15, 2018 at 02:43PM by sp3co92

No comments:

Post a Comment