---
title: "Discussion on \"Handling authentication in NodeJS using JWT Tokens 🚀\" | Hashnode"
description: "Discussion on \"Handling authentication in NodeJS using JWT Tokens 🚀\". jwt tokens, accessToken, refreshToken, jwt token, authentication using jwt tokens,authentication in NodeJS using JWT Tokens"
url: "https://hashnode.com/posts/handling-authentication-in-nodejs-using-jwt-tokens/638dacefc106d3bd51166cc4"
---

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

Discussion

# [Handling authentication in NodeJS using JWT Tokens 🚀](https://jaydeepdey03.hashnode.dev/handling-authentication-in-nodejs-using-jwt-tokens?utm_source=hashnode&utm_medium=feed)

jwt tokens, accessToken, refreshToken, jwt token, authentication using jwt tokens,authentication in NodeJS using JWT Tokens

Dec 5, 2022 · 11 min read · jaydeepdey03.hashnode.dev  
Updated Jul 16, 2023  
Read the article

-   [#refreshtoken](https://hashnode.com/tag/refreshtoken)
-   [#accesstoken](https://hashnode.com/tag/accesstoken)
-   [#authentication](https://hashnode.com/tag/authentication)
-   [#jwt](https://hashnode.com/tag/jwt)
-   [#nodejs](https://hashnode.com/tag/nodejs)

## Written by

[Jaydeep Dey](https://hashnode.com/@jaydeepdey03)

@jaydeepdey03 · Kolkata, India

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

Innovative developer skilled in blockchain dApps, Solidity, Ethereum, and MERN stack development.

## Responses 1

Markdown supported · ⌘↵ to post

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Dec 11, 2022](https://hashnode.com/posts/handling-authentication-in-nodejs-using-jwt-tokens/638dacefc106d3bd51166cc4/comment/63956df49fa713176ab9d887)

Hello, I have a question. I see you talk about "refresh tokens stored in the database". Why are you storing tokens in the database? It is as insecure as saving a password in clear text. What is the purpose of having all the tokens saved since it is so risky?

[Jaydeep Dey](https://hashnode.com/@jaydeepdey03)

[Dec 11, 2022](https://hashnode.com/posts/handling-authentication-in-nodejs-using-jwt-tokens/638dacefc106d3bd51166cc4/comment/63956df49fa713176ab9d887#reply-6395a67515750808b269c8f7)

Thanks for pointing it out Jose. In production environment, we aren't suppose to reveal the token, both in the client side as well as the server side. The steps I have mentioned are to be followed in the development environment. In some scenario, people often encrypt refreshToken and store it in database. Storing tokens in clear text in not recommended.

You can refer to this link for more detailed explaination:

[stackoverflow.com/questions/59511628/is-it-secure…](https://stackoverflow.com/questions/59511628/is-it-secure-to-store-a-refresh-token-in-the-database-to-issue-new-access-toke)
