Authentication in NestJS with PassportJS and Prisma

NestJs Auth

NestJS Authentication with JWT, PassportJs, and Prisma

Getting Started

Clone the repository: git clone https://github.com/saidMounaim/nest-auth.git

Install dependencies: npm install

Create a .env file in the root a…


This content originally appeared on DEV Community and was authored by Said Mounaim

NestJs Auth

NestJS Authentication with JWT, PassportJs, and Prisma

Getting Started

  1. Clone the repository: git clone https://github.com/saidMounaim/nest-auth.git
  2. Install dependencies: npm install
  3. Create a .env file in the root and add the following
DATABASE_URL=""

JWT_SECRET=""
  1. Start the development server: npm run dev

Built With

Endpoints

Login

/auth/login

Method: POST\
Description: Authenticates a user and returns a JWT token.\
Body:

{
  "email": "string",
  "password": "string"
}

Register

/auth/register

Method: POST\
Description: Registers a new user and returns a user info.\
Body:

{
  "name": "string",
  "email": "string",
  "password": "string"
}

Get currect user

/auth/profile

Method: GET\
Description: Retrieves user profile information. Requires a Bearer token for authentication.\
Body:

Authorization: Bearer <token>

Contribution

All kind of contributions are welcome, please feel free to submit pull requests.


This content originally appeared on DEV Community and was authored by Said Mounaim


Print Share Comment Cite Upload Translate Updates
APA

Said Mounaim | Sciencx (2024-09-04T11:22:49+00:00) Authentication in NestJS with PassportJS and Prisma. Retrieved from https://www.scien.cx/2024/09/04/authentication-in-nestjs-with-passportjs-and-prisma/

MLA
" » Authentication in NestJS with PassportJS and Prisma." Said Mounaim | Sciencx - Wednesday September 4, 2024, https://www.scien.cx/2024/09/04/authentication-in-nestjs-with-passportjs-and-prisma/
HARVARD
Said Mounaim | Sciencx Wednesday September 4, 2024 » Authentication in NestJS with PassportJS and Prisma., viewed ,<https://www.scien.cx/2024/09/04/authentication-in-nestjs-with-passportjs-and-prisma/>
VANCOUVER
Said Mounaim | Sciencx - » Authentication in NestJS with PassportJS and Prisma. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/04/authentication-in-nestjs-with-passportjs-and-prisma/
CHICAGO
" » Authentication in NestJS with PassportJS and Prisma." Said Mounaim | Sciencx - Accessed . https://www.scien.cx/2024/09/04/authentication-in-nestjs-with-passportjs-and-prisma/
IEEE
" » Authentication in NestJS with PassportJS and Prisma." Said Mounaim | Sciencx [Online]. Available: https://www.scien.cx/2024/09/04/authentication-in-nestjs-with-passportjs-and-prisma/. [Accessed: ]
rf:citation
» Authentication in NestJS with PassportJS and Prisma | Said Mounaim | Sciencx | https://www.scien.cx/2024/09/04/authentication-in-nestjs-with-passportjs-and-prisma/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.