---
title: "Comment by José Pablo Ramírez Vargas on \"Handling authentication in NodeJS using JWT Tokens 🚀\" | Hashnode"
description: "Hello, I have a question. I see you talk about &quot;refresh tokens stored in the database&quot;. Why are you storing tokens in the database? It is as insecure"
url: "https://hashnode.com/posts/handling-authentication-in-nodejs-using-jwt-tokens/638dacefc106d3bd51166cc4/comment/63956df49fa713176ab9d887"
---

[Discussion](https://hashnode.com/posts/handling-authentication-in-nodejs-using-jwt-tokens/638dacefc106d3bd51166cc4)

Comment [Handling authentication in NodeJS using JWT Tokens 🚀](https://hashnode.com/posts/handling-authentication-in-nodejs-using-jwt-tokens/638dacefc106d3bd51166cc4)

[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)
