All Projects → bezkoder → react-jwt-auth

bezkoder / react-jwt-auth

Licence: other
React JWT Authentication & Authorization example - React.js Login and Registration example

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to react-jwt-auth

react-redux-jwt-auth
React Redux: Token Authentication example with JWT, React Router, Axios, Thunk Middleware
Stars: ✭ 86 (-71.99%)
Mutual labels:  authorization, axios, jwt-authentication
react-auth-kit
Easily manage Authentication state of users in React-based Apps using Hooks and Higher-order components
Stars: ✭ 177 (-42.35%)
Mutual labels:  authorization, jwt-authentication
spring-boot-login-example
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example
Stars: ✭ 50 (-83.71%)
Mutual labels:  authorization, jwt-authentication
caddy-authorize
Authorization Plugin for Caddy v2 (JWT/PASETO)
Stars: ✭ 235 (-23.45%)
Mutual labels:  authorization, jwt-authentication
Quora
Building An Exclusive Community of PEC Graduates and Students.The main features of the website are “PEC Quora” and “PEC Connect”
Stars: ✭ 26 (-91.53%)
Mutual labels:  axios, jwt-authentication
My Idea Pool Client
💡💡 React + Redux + JWT (Auth) + Formik (Forms). Store and rank your ideas.
Stars: ✭ 18 (-94.14%)
Mutual labels:  axios, jwt-authentication
node-js-jwt-auth
Node.js Demo for Token Based Authentication (JWT) with MySQL database
Stars: ✭ 161 (-47.56%)
Mutual labels:  authorization, jwt-authentication
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-50.16%)
Mutual labels:  authorization, jwt-authentication
Caddy Auth Jwt
JWT Authorization Plugin for Caddy v2
Stars: ✭ 127 (-58.63%)
Mutual labels:  authorization, jwt-authentication
Spring Boot Oauth2 Jwt Swagger Ui
Spring Boot , OAuth 2 , JWT (Json Web Token) and Swagger UI
Stars: ✭ 77 (-74.92%)
Mutual labels:  authorization, jwt-authentication
reactjs-login-register-crud
ReactJS CRUD Application, ReactJS FileUpload, ReactJS Sample application, ReactJS Boilerplate, ReactJS Login, ReactJS FileUpload, ReactJS Register
Stars: ✭ 47 (-84.69%)
Mutual labels:  axios, jwt-authentication
Oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
Stars: ✭ 2,323 (+656.68%)
Mutual labels:  authorization, jwt-authentication
shopping-cart
A simple Shopping-cart built with React and Django REST Framework(DRF)
Stars: ✭ 41 (-86.64%)
Mutual labels:  axios, jwt-authentication
spring-boot-security-postgresql
Spring Boot, Spring Security, PostgreSQL: JWT Authentication & Authorization example
Stars: ✭ 65 (-78.83%)
Mutual labels:  authorization, jwt-authentication
Keeper
Stars: ✭ 23 (-92.51%)
Mutual labels:  authorization, jwt-authentication
Spotify Clone Client
A ReactJS clone application of the popular Spotify music streaming service. This application utilizes the Spotify API and the Spotify Web Playback SDK
Stars: ✭ 162 (-47.23%)
Mutual labels:  authorization, axios
react-admin-nest
React和Ant Design和 Nest.js 和 Mysql 构建的后台通用管理系统。持续更新。
Stars: ✭ 123 (-59.93%)
Mutual labels:  react-components, axios
React-Express-JWT-UserPortal
React.js & Express.js User portal Using Core UI, JWT, JWT Token, Refresh Token, Role & Permission management, User manamgenet, Event Log.
Stars: ✭ 22 (-92.83%)
Mutual labels:  jwt-authentication
auth
🔑 Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
Stars: ✭ 39 (-87.3%)
Mutual labels:  authorization
exposed-ktor-jwt
example of an exposed+ktor+jwt secured kotlin app sporting an angular frontend
Stars: ✭ 21 (-93.16%)
Mutual labels:  jwt-authentication

React JWT Authentication (without Redux) example

In this tutorial, we’re gonna build a React JWT Authentication example with LocalStorage, React Router, Axios and Bootstrap (without Redux). I will show you:

  • JWT Authentication Flow for User Signup & User Login
  • Project Structure for React JWT Authentication (without Redux) with LocalStorage, React Router & Axios
  • Creating React Components with Form Validation
  • React Components for accessing protected Resources (Authorization)
  • Dynamic Navigation Bar in React App

User Registration and User Login Flow

For JWT Authentication, we’re gonna call 2 endpoints:

  • POST api/auth/signup for User Registration
  • POST api/auth/signin for User Login

The following flow shows you an overview of Requests and Responses that React Client will make or receive. This React Client must add a JWT to HTTP Header before sending request to protected resources.

react-jwt-authentication-flow

Demo Video

This is full React + Node.js Express JWT Authentication & Authorization demo (with form validation, check signup username/email duplicates, test authorization with 3 roles: Admin, Moderator, User):

react-express-authentication-jwt-example-feature-image

Or React with Spring Boot Server:

Spring Boot Reactjs JWT Authentication example

React Component Diagram with Router, Axios & LocalStorage

react-jwt-authentication-project-overview

For more detail, please visit:

React (without Redux) JWT Authentication & Authorization example

React JWT Authentication & Authorization example with HttpOnly Cookie

React - How to Logout when Token is expired

React Redux JWT Authentication & Authorization example

React Hooks: JWT Authentication & Authorization example

React + Redux + Hooks: JWT Authentication & Authorization example

This project was bootstrapped with 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).

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 to view it in the browser.

The page will reload if you make edits.

Related Posts

In-depth Introduction to JWT-JSON Web Token

React.js CRUD example to consume Web API

React Pagination example

React File Upload with Axios and Progress Bar to Rest API

Fullstack (JWT Authentication & Authorization example):

React + Spring Boot

React + Node.js Express

CRUD with Node.js Express:

React.js + Node.js Express + MySQL

React.js + Node.js Express + PostgreSQL

React.js + Node.js Express + MongoDB

CRUD with Spring Boot:

React.js + Spring Boot + MySQL

React.js + Spring Boot + PostgreSQL

React.js + Spring Boot + MongoDB

CRUD with Django:

React.js + Django Rest Framework

Serverless:

React Firebase CRUD App with Realtime Database

React Firestore CRUD App example | Firebase Cloud Firestore

Integration (run back-end & front-end on same server/port)

Integrate React with Spring Boot

Integrate React with Node.js Express

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].