Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iammahesh123/oauth-with-jwt-authorization

this project is basically a cool demo showing how we handle user authentication using OAuth2 and JWT tokens in a Spring Boot app. You know, stuff like registering users, logging them in, and generating those snazzy tokens.
https://github.com/iammahesh123/oauth-with-jwt-authorization

java jwt-authentication jwt-token maven oauth2 spring-boot spring-data-mongodb spring-security tomcat-server

Last synced: 20 days ago
JSON representation

this project is basically a cool demo showing how we handle user authentication using OAuth2 and JWT tokens in a Spring Boot app. You know, stuff like registering users, logging them in, and generating those snazzy tokens.

Awesome Lists containing this project

README

        

# OAuth2 Authentication with Spring Boot 🚀
Hey there! Welcome to our OAuth2 authentication project built with Spring Boot. This readme will get you up to speed on what this project does and how you can use it.

## What's This All About?
So, this project is basically a cool demo showing how we handle user authentication using OAuth2 and JWT tokens in a Spring Boot app. You know, stuff like registering users, logging them in, and generating those snazzy tokens.

## How to Get Started
Prerequisites
Before you dive in, make sure you have the following installed:

## Java Development Kit (JDK) 8 or higher
Apache Maven
MongoDB or another supported database (you'll need to configure this in application.properties)
Postman or some other tool for testing APIs

### Step 1: Clone the Project

1. Open a terminal on your computer.

2. Clone the project repository by running the following command:
```bash
git clone [](https://github.com/iammahesh123/oAuth-with-jwt-authorization.git)
cd JwtAuthorizationdemo

3. Go to the Project Directory: Jump into the project folder
```bash
mvn clean install
4. Run the App: Start the Spring Boot magic:
```bash
mvn spring-boot:run

## How to Use It

Once the app is up and running, you can start playing around with it using some HTTP requests. Here's a quick rundown of the available endpoints:

`POST /api/auth/register`: Register a new user. Just send over a JSON with userName and password, and you'll get a JWT token in return!

`POST /api/auth/login` : Log in an existing user. Again, a JSON with userName and password will do the trick. You'll get a shiny new JWT token as a reward for logging in successfully.

`POST /api/auth/token` : Need to refresh your JWT token? No problemo! Send the old token as refreshToken in a JSON payload, and voilà! You'll get a fresh one in return.

## Contributing

We're totally open to contributions! Found a bug? Have an awesome idea for an improvement? Feel free to open an issue or send us a pull request. Let's make this project even better together!

## License

This project is licensed under the MIT License. So go ahead, tweak it, share it, do whatever you want with it (just don't forget to credit us 😉).