Skip to content

Commit

Permalink
Merge pull request #149 from Pulkit95700/jwt-authentication-backend
Browse files Browse the repository at this point in the history
Jwt authentication backend
  • Loading branch information
Avdhesh-Varshney authored May 18, 2024
2 parents cb5850c + aa6a624 commit 5bd26bf
Show file tree
Hide file tree
Showing 24 changed files with 1,950 additions and 2 deletions.
101 changes: 101 additions & 0 deletions Node-JS-Projects/Intermediate/JWT-Authenticator-With-Roles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<h1 align='center'><b>💥 JWT-Authenticator-With-Roles 💥</b></h1>

<div align='center' style='display: flex; justify-content: center; gap: 1rem'>

![Nodemon](https://img.shields.io/badge/NODEMON-%23323330.svg?style=for-the-badge&logo=nodemon&logoColor=%BBDEAD)

![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB)

![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white)

![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white)

</div>

![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847)


## Description 📃

<div>
<p>This api helps user to get a modern starting project for production use. This is a standard setup for any production level project. The different files are used to handle different functions. You can clone it to get started on your project quickly.

This readme file provides all the details you need to run and use this project.</p>
</div>


## How to run it? 🕹️

- Clone the repository
- Run `npm install`
- Create a `.env` file and add the following variables
- `PORT`
- `ACCESS_TOKEN_SECRET`
- `REFRESH_TOKEN_SECRET`
- `ACCESS_TOKEN_EXPIRY`
- `REFRESH_TOKEN_EXPIRY`
- `BCRYPT_SALT`
- `MONGODB_URI`
- `CORS_ORIGIN`
- Run `npm run dev` or `npm start`



## Features

- **User Authentication**

- Register
- Login
- Logout
- Refresh Token

- **User Roles**
- Admin
- User

## Screenshots of Endpoints

**POST `api/v1/user/register`**

![alt text](images/image.png)

**POST `api/v1/user/register-admin`**

![alt text](images/register_admin.png)

**POST `api/v1/user/login`**

![alt text](images/image-1.png)

**POST `api/v1/user/logout`**

![alt text](images/logout.png)

**POST `api/v1/user/refresh-token`**

![alt text](images/refresh.png)

**GET `api/v1/user/i-am-user`**

![alt text](images/protectedUser.png)

**GET `api/v1/user/i-am-admin`**

![alt text](images/protected_admin.png)

![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847)

<h4 align='center'>Developed By <b><i>PULKIT GUPTA</i></b> 👦</h4>
<p align='center'>
<a href='https://www.linkedin.com/in/pulkit-gupta-b16a721ba'>
<img src='https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white' />
</a>
<a href='https://github.com/Pulkit95700'>
<img src='https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white' />
</a>
</p>

<h4 align='center'>Happy Coding 🧑‍💻</h4>

<h3 align="center">Show some &nbsp;❤️&nbsp; by &nbsp;🌟&nbsp; this repository!</h3>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5bd26bf

Please sign in to comment.