Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Spring Boot JWT Authentication with React

Implemented secure authentication using Spring Security and JWT, integrating a React frontend with protected REST APIs and token-based authorization. It implements a simple login system where users authenticate and receive a JWT token, which is then used to access protected APIs.

The goal of this project is to demonstrate secure authentication flow between a React frontend and a Spring Boot backend using JWT.


πŸš€ Features

  • User Login Authentication
  • JWT Token Generation
  • Secure API Access using JWT
  • Token validation using Spring Security filters
  • React frontend for login interface
  • Protected API endpoints
  • Full stack authentication flow demo

πŸ—οΈ Project Architecture

React Frontend
      β”‚
      β”‚ HTTP Request (Login)
      β–Ό
Spring Boot Backend
      β”‚
      β”‚ Generate JWT Token
      β–Ό
Client Receives Token
      β”‚
      β”‚ Token sent in Authorization Header
      β–Ό
Protected Spring Boot APIs

πŸ› οΈ Tech Stack

Backend

  • Spring Boot
  • Spring Security
  • JWT (JSON Web Token)
  • Maven
  • Java

Frontend

  • React.js
  • JavaScript
  • HTML
  • CSS
  • Axios (for API requests)

πŸ” Authentication Flow

  1. User enters username and password in React login page
  2. React sends request to Spring Boot login API
  3. Spring Boot validates credentials
  4. If valid β†’ JWT token is generated
  5. Token is sent back to React
  6. React stores the token
  7. Token is sent in Authorization Header for protected API requests

Example header:

Authorization: Bearer <JWT_TOKEN>

πŸ’‘ Learning Objectives

This project demonstrates:

  • How JWT authentication works
  • Integration of Spring Security with JWT
  • Communication between React and Spring Boot
  • Securing REST APIs using token-based authentication

πŸ‘¨β€πŸ’» Author

Mohit Kumar


⭐ If you found this project helpful, consider giving it a star!

About

Implemented secure authentication using Spring Security and JWT, integrating a React frontend with protected REST APIs and token-based authorization.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages