---
title: "Comment by Fábio Rosado on \"Keeping secrets safe with Next.js API routes\" | Hashnode"
description: "This is a great write up Kevin! One thing worth to mention is that if you are using fetch/axios and have to pass an API Token to your header, even if you use a"
url: "https://hashnode.com/posts/keeping-secrets-safe-with-nextjs-api-routes/5f8157675841661b519d0260/comment/5f8177b27762251b305d8ec1"
---

[Discussion](https://hashnode.com/posts/keeping-secrets-safe-with-nextjs-api-routes/5f8157675841661b519d0260)

Comment [Keeping secrets safe with Next.js API routes](https://hashnode.com/posts/keeping-secrets-safe-with-nextjs-api-routes/5f8157675841661b519d0260)

[Fábio Rosado](https://hashnode.com/@FabioRosado)

[Oct 10, 2020](https://hashnode.com/posts/keeping-secrets-safe-with-nextjs-api-routes/5f8157675841661b519d0260/comment/5f8177b27762251b305d8ec1)

This is a great write up Kevin! One thing worth to mention is that if you are using fetch/axios and have to pass an API Token to your header, even if you use a variable from `.env` it will be visible on the network tab of your browser.

I know that this might be a bit out of the scope of this article, but I remember when I learned about keeping secrets safe, I thought I could just use `.env` to hide my API keys until someone told me that you could see them in the network tab haha

So yeah, in this case, the best way to do it is by using a serverless function. Like you said on the article if you use Netlify or Vercel both allow you to use serverless functions and you could fetch your super-secret endpoint with your API tokens there

[Kevin Cunningham](https://hashnode.com/@dolearning)

[Oct 10, 2020](https://hashnode.com/posts/keeping-secrets-safe-with-nextjs-api-routes/5f8157675841661b519d0260/comment/5f8177b27762251b305d8ec1#reply-5f81e0ff5841661b519d07e8)

Totally, Fabio, thanks! Anything that is available to your front end code is available to the client and as you say, the easiest way to find this is through looking at the network tab.

Using authentication and token bearing, like JWTs, are ways to make this harder. All of these security measures are a trade off between complexity, convenience and secrecy.

Thanks for the comment :)
