This project was forked from Shouhaei Yamauchi's repo and altered to change the file structure and directory names to line up with my personal preferences, as well as being refactored to use react-scripts and create-react-app for the react portion.
The code has also been refactored to remove the constructor from the component classes, as well as incorporating axios instead of using an XMLHttpRequest.
The below description is the original author's.
An example application which combines a back-end which stores user data and front-end React.js application which handles user authentication sessions.
This application be easily separated into two completely different repositories.
Created using the tutorials below:
https://vladimirponomarev.com/blog/authentication-in-react-apps-creating-components https://vladimirponomarev.com/blog/authentication-in-react-apps-jwt
However, this version has replaced the React Router v3 which were used in the above tutorials with the most recent React Router v4 which has some major differences. I also made some minor tweaks to account for the NPM packages which had issues due to updates since the tutorial was published.
This application incorporates the following packages:
- axios
- bcryptjs
- jsonwebtoken
- mongoose
- passport
- react-router-dom
- validator
After cloning the repo, follow the steps below:
$ cd react-passport-example
$ sudo mongod
$ yarn install
$ cd client && yarn install
$ cd .. && yarn start
When ready to deploy, build your final application with:
$ yarn build
Home page before login:
Sign up page:
Login page:
Dashboard which is only accessible after login: