# Backend API - Storing API Keys

**URL:** <https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964>\
**Category:** General\
**Tags:** apikey, nodejs, api, backend\
**Created:** [May 12, 2017, 1:42pm UTC](https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964 "2017-05-12T13:42:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![deuscode](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/deuscode/32/37258_2.png) [@deuscode](https://forum.freecodecamp.org/u/deuscode)\
**Post date:** [May 12, 2017, 1:42pm UTC](https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964/1 "2017-05-12T13:42:33Z")

</div>

Hello fellow campers,

Can anyone recommend me some tutorials on using node.js to create a backend that stores API Keys for my applications to call via AJAX?

I have been searching for a while now and there doesn’t seem to be any in depth tutorials I can find.

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![AgathaLynn](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@AgathaLynn](https://forum.freecodecamp.org/u/AgathaLynn)\
**Post date:** [May 12, 2017, 2:39pm UTC](https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964/2 "2017-05-12T14:39:15Z")

</div>

Have you worked with Node before? Used it to set up a server?

I just finished working through the API projects, and I don’t have any tutorials to recommend, but here are some resources to get you started:

- If you haven’t set up a server before, working through Express’s “getting started” guide really helped me get things up and going.
- I used the npm request module for API calls - that seems to be the most common.
- As for the API keys - have you worked with environmental variables before? That might be a search term you haven’t tried. Anyway, I stored my api keys inside of a file named `.env` (and made sure that that file didn’t end up on github). If you’re on Windows, you can use [dotenv](https://www.npmjs.com/package/dotenv) to access those variables (there’s instructions in the documentation).

Don’t know if that helps any?

---

<div class="post-metadata">

**Author:** ![deuscode](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/deuscode/32/37258_2.png) [@deuscode](https://forum.freecodecamp.org/u/deuscode)\
**Post date:** [May 12, 2017, 6:02pm UTC](https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964/3 "2017-05-12T18:02:03Z")

</div>

Thanks for the reply Agatha!

I’ve used Node and npm request module before, but I’ll definitely look into a couple of your suggestions. I was hoping to see a couple of examples on going through the process. I’ll be sure to take a look at the dotenv module for environmental variables. Thanks!

---

<div class="post-metadata">

**Author:** ![ZackWard](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/zackward/32/159484_2.png) [@ZackWard](https://forum.freecodecamp.org/u/ZackWard)\
**Post date:** [May 12, 2017, 6:37pm UTC](https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964/4 "2017-05-12T18:37:05Z")

</div>

I also use the dotenv package, and a .env file. One thing to remember: be sure not to commit your .env file to GitHub. 😄

---

<div class="post-metadata">

**Author:** ![deuscode](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/deuscode/32/37258_2.png) [@deuscode](https://forum.freecodecamp.org/u/deuscode)\
**Post date:** [May 23, 2017, 2:43am UTC](https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964/5 "2017-05-23T02:43:10Z")

</div>

Thanks Zack! I’ll be sure to look into using dotenv. Thanks for all the recommendations!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:54pm UTC](https://forum.freecodecamp.org/t/backend-api-storing-api-keys/114964/6 "2021-01-17T20:54:20Z")

</div>

Closed on January 17, 2021, 8:54pm UTC


