DEV Community

Said MOUNAIM
Said MOUNAIM

Posted on

3 1 1 1 1

Authentication in NestJS with PassportJS and Prisma

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=""
Enter fullscreen mode Exit fullscreen mode
  1. Start the development server: npm run dev

Built With

Endpoints

Login

/auth/login
Enter fullscreen mode Exit fullscreen mode

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

{
  "email": "string",
  "password": "string"
}
Enter fullscreen mode Exit fullscreen mode

Register

/auth/register
Enter fullscreen mode Exit fullscreen mode

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

{
  "name": "string",
  "email": "string",
  "password": "string"
}
Enter fullscreen mode Exit fullscreen mode

Get currect user

/auth/profile
Enter fullscreen mode Exit fullscreen mode

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

Authorization: Bearer <token>
Enter fullscreen mode Exit fullscreen mode

Contribution

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

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more