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.
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.
Prerequisites Before you dive in, make sure you have the following installed:
Apache Maven MongoDB or another supported database (you'll need to configure this in application.properties) Postman or some other tool for testing APIs
-
Open a terminal on your computer.
-
Clone the project repository by running the following command:
git clone [<repository-url>](https://github.com/iammahesh123/oAuth-with-jwt-authorization.git) cd JwtAuthorizationdemo
-
Go to the Project Directory: Jump into the project folder
mvn clean install
-
Run the App: Start the Spring Boot magic:
mvn spring-boot:run
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.
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!
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 😉).