---
title: "Discussion on \"User Authentication and Authorization using npm bcryptjs, JWT, and MongoDB Atlas\" | Hashnode"
description: "Discussion on \"User Authentication and Authorization using npm bcryptjs, JWT, and MongoDB Atlas\". Let us build an express API for this."
url: "https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [User Authentication and Authorization using npm bcryptjs, JWT, and MongoDB Atlas](https://prachi824.hashnode.dev/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas?utm_source=hashnode&utm_medium=feed)

Let us build an express API for this.

Jul 8, 2021 · 5 min read · prachi824.hashnode.dev  
Read the article

-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#express](https://hashnode.com/tag/express)
-   [#mongodb](https://hashnode.com/tag/mongodb)
-   [#npm](https://hashnode.com/tag/npm)

## Written by

[Prachi Mane](https://hashnode.com/@PrachiM)

@PrachiM

  
[View profile](https://hashnode.com/@PrachiM)

A Little Progress Each Day Adds Up The Big Result

## Responses 4

Markdown supported · ⌘↵ to post

[ForgetPasses](https://hashnode.com/@Forgetpasses)

[Feb 24, 2023](https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717/comment/63f904345ebda1e9aa53cd3b)

Hey very good post! I hope you writemore posts like this with other authentication packages :D

[baddev](https://hashnode.com/@badev)

[Nov 29, 2021](https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717/comment/61a555d89ac0d611876b2880)

Your article is good to start :)

But there are some errors.

Firstly, you shouldn't return status 500 if it's not a internal error, bad credential is a 4xx. Not a big mistake, but if you give your API to an other dev he'll thing your server is broken.

Secondly, for security concern, you shouldn't give any informations except that the given informations were wrong when a user is trying to signing in (no "password incorrect").

Hope it will help other.

[Prachi Mane](https://hashnode.com/@PrachiM)

[Nov 30, 2021](https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717/comment/61a555d89ac0d611876b2880#reply-61a5c2ca2be89f3d0aba0de0)

[baddev](https://hashnode.com/@badev) Thank you for reviewing the blog and pointing this out. It's very helpful!

[Andrew Baisden](https://hashnode.com/@andrewbaisden)

[Jul 8, 2021](https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717/comment/60e7110f3dc33f032e23b659)

Perfect timing I am working on this exact tech stack right now in a project. Good article [Prachi Mane](https://hashnode.com/@PrachiM) .

[Prachi Mane](https://hashnode.com/@PrachiM)

[Jul 8, 2021](https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717/comment/60e7110f3dc33f032e23b659#reply-60e722054e18000309d811ed)

Glad to know! Thank you [Andrew Baisden](https://hashnode.com/@andrewbaisden)

[Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)

[Jul 8, 2021](https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717/comment/60e6f6ff3dc33f032e23b3bc)

You did a great job explaning everythin! Keep posting quality articles [Prachi Mane](https://hashnode.com/@PrachiM).

[Prachi Mane](https://hashnode.com/@PrachiM)

[Jul 8, 2021](https://hashnode.com/posts/user-authentication-and-authorization-using-npm-bcryptjs-jwt-and-mongodb-atlas/60e68110c32fbd1b73720717/comment/60e6f6ff3dc33f032e23b3bc#reply-60e721b83dc33f032e23b934)

Thanks a lot! [Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)
