reactjs - React Authentication -


looking add login page app, there aren't date tutorials react or react-router.

thinking passport js, , having reroute react app upon successful authentication.

thoughts? there better way?

you can protect routes onenter callback

reactdom.render(     (       <provider store={store}>         <router history={browserhistory}>             <route path="/" component={nav} >                 <indexroute component={home}/>                 <route path='/customers' component={customers} onenter={signin}/>                 <route path='/vendors' component={vendors} onenter={signin}/>          </router>       </provider>     ), document.getelementbyid('reactentry')); 

in signin function, need check if user can log in. if not, display error message

also, here example: https://developer.okta.com/blog/2017/03/30/react-okta-sign-in-widget


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -