https://github.com/bezkoder/react-redux-hooks-jwt-auth
React Redux Login, Logout, Registration example using Hooks, JWT, Local Storage, React Router, Thunk Middleware, Axios, Bootstrap
https://github.com/bezkoder/react-redux-hooks-jwt-auth
authentication authorization axios jwt-authentication react react-hooks react-jwt react-redux react-router reactjs redux
Last synced: 27 days ago
JSON representation
React Redux Login, Logout, Registration example using Hooks, JWT, Local Storage, React Router, Thunk Middleware, Axios, Bootstrap
- Host: GitHub
- URL: https://github.com/bezkoder/react-redux-hooks-jwt-auth
- Owner: bezkoder
- Created: 2020-09-03T03:06:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-21T11:31:28.000Z (over 2 years ago)
- Last Synced: 2025-03-28T10:47:33.487Z (about 1 month ago)
- Topics: authentication, authorization, axios, jwt-authentication, react, react-hooks, react-jwt, react-redux, react-router, reactjs, redux
- Language: JavaScript
- Homepage:
- Size: 480 KB
- Stars: 162
- Watchers: 6
- Forks: 97
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## React Redux Login, Logout, Registration example using Hooks
For more detail, please visit:
> [React Redux Login, Logout, Registration example with Hooks](https://bezkoder.com/react-hooks-redux-login-registration-example/)> [React Hooks: JWT Authentication & Authorization (without Redux) example](https://bezkoder.com/react-hooks-jwt-auth/)
> [React Redux Login, Logout, Registration example (using React Components)](https://bezkoder.com/react-redux-jwt-auth/)
Fullstack (JWT Authentication & Authorization example):
> [React + Spring Boot](https://bezkoder.com/spring-boot-react-jwt-auth/)> [React + Node.js Express](https://bezkoder.com/react-express-authentication-jwt/)
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
### Set port
.env
```
PORT=8081
```### Note:
Open `src/services/auth-header.js` and modify `return` statement for appropriate back-end (found in the tutorial).```js
export default function authHeader() {
const user = JSON.parse(localStorage.getItem('user'));if (user && user.accessToken) {
// return { Authorization: 'Bearer ' + user.accessToken }; // for Spring Boot back-end
return { 'x-access-token': user.accessToken }; // for Node.js Express back-end
} else {
return {};
}
}
```### Project setup
In the project directory, you can run:
```
npm install
# or
yarn install
```or
### Compiles and hot-reloads for development
```
npm start
# or
yarn start
```Open [http://localhost:8081](http://localhost:8081) to view it in the browser.
The page will reload if you make edits.
### Related Posts
> [In-depth Introduction to JWT-JSON Web Token](https://bezkoder.com/jwt-json-web-token/)> [React CRUD example using Hooks](https://bezkoder.com/react-hooks-crud-axios-api/)
> [React Pagination using Hooks example](https://bezkoder.com/react-pagination-hooks/)
> [React Hooks File Upload example](https://bezkoder.com/react-hooks-file-upload/)
Fullstack with Node.js Express:
> [React.js + Node.js Express + MySQL](https://bezkoder.com/react-node-express-mysql/)> [React.js + Node.js Express + PostgreSQL](https://bezkoder.com/react-node-express-postgresql/)
> [React.js + Node.js Express + MongoDB](https://bezkoder.com/react-node-express-mongodb-mern-stack/)
Fullstack with Spring Boot:
> [React.js + Spring Boot + MySQL](https://bezkoder.com/react-spring-boot-crud/)> [React.js + Spring Boot + PostgreSQL](https://bezkoder.com/spring-boot-react-postgresql/)
> [React.js + Spring Boot + MongoDB](https://bezkoder.com/react-spring-boot-mongodb/)
Fullstack with Django:
> [React.js Hooks + Django Rest Framework](https://bezkoder.com/django-react-hooks/)Serverless:
> [React Hooks Firebase Realtime Database: CRUD App ](https://bezkoder.com/react-firebase-hooks-crud/)> [React Hooks Firestore example: CRUD App](https://bezkoder.com/react-hooks-firestore/)
Integration (run back-end & front-end on same server/port)
> [Integrate React with Spring Boot](https://bezkoder.com/integrate-reactjs-spring-boot/)> [Integrate React with Node.js Express](https://bezkoder.com/integrate-react-express-same-server-port/)