DEV Community

Discussion on: React Authentication - LOGIN

Collapse
 
eljeffe profile image
elJeffe

Great tutorial! Just wondering how do you redirect the user to an (authenticated) url? Because if I use useHistory().push('/auth'); in the button click it won't work as the state is still false.

Collapse
 
ebereplenty profile image
NJOKU SAMSON EBERE

I will be going in detail on this in the next article. It will be out next week.

Meanwhile, you can use cookies to make the Auth token available in all of your pages. Then use token to make the API call

We also have the concept of protected routes in React where only authenticated users can access such routes.