# Paste API Private Keys in Codepen?

**URL:** <https://forum.freecodecamp.org/t/paste-api-private-keys-in-codepen/123769>\
**Category:** General\
**Created:** [June 5, 2017, 3:28pm UTC](https://forum.freecodecamp.org/t/paste-api-private-keys-in-codepen/123769 "2017-06-05T15:28:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremybeasley](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremybeasley/32/30786_2.png) [@jeremybeasley](https://forum.freecodecamp.org/u/jeremybeasley)\
**Post date:** [June 5, 2017, 3:28pm UTC](https://forum.freecodecamp.org/t/paste-api-private-keys-in-codepen/123769/1 "2017-06-05T15:28:57Z")

</div>

Many of the assignments ask that we show our work in CodePen. However, many of the assignments also require API requests which expose our private API keys.

Many of the API docs say to not expose the secret API keys in your js. If that’s the case, how do I post to Codepen without exposing it? 🤔

---

<div class="post-metadata">

**Author:** ![owel](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/owel/32/48425_2.png) [@owel](https://forum.freecodecamp.org/u/owel)\
**Post date:** [June 5, 2017, 3:39pm UTC](https://forum.freecodecamp.org/t/paste-api-private-keys-in-codepen/123769/2 "2017-06-05T15:39:13Z")

</div>

They’re all free accounts API anyway… they’re giving away these free API accounts like candy to anybody.

Now, if it’s a paid/pro API account, it would be a different matter.

---

<div class="post-metadata">

**Author:** ![IsaacAbrahamson](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/isaacabrahamson/32/30882_2.png) [@IsaacAbrahamson](https://forum.freecodecamp.org/u/IsaacAbrahamson)\
**Post date:** [June 5, 2017, 3:55pm UTC](https://forum.freecodecamp.org/t/paste-api-private-keys-in-codepen/123769/3 "2017-06-05T15:55:14Z")

</div>

> [@jeremybeasley](#):
>
> Many of the API docs say to not expose the secret API keys in your js. If that’s the case, how do I post to Codepen without exposing it? 🤔

Any api key on the client will be noticeable, there is really no way to hide it. Usually the server gets the data, and then sends the code to the browser with the data already there. The purpose of hiding the key is so others can’t steal it. If other’s get your key, they can use it to request data from the API - costing you more money as you only get so many requests for data or the company charges you more. As mentioned above you don’t really need to hide the key if its free because thieves aren’t interested in it.

* * *

If for some reason you absolutely have to, and to answer your question, you can do so easily by making your own api for the api:

- Go to [www.glitch.com](http://www.glitch.com)
- Get the data ([example](https://stackoverflow.com/questions/9577611/http-get-request-in-node-js-express))
- Create an endpoint with Express and make sure you allow cross-origin to codepen
- BOOM your key is hidden on codepen.
- I really have no idea why you would even want to do this 😒

---

<div class="post-metadata">

**Author:** ![honmanyau](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/honmanyau/32/45787_2.png) [@honmanyau](https://forum.freecodecamp.org/u/honmanyau)\
**Post date:** [June 6, 2017, 2:55am UTC](https://forum.freecodecamp.org/t/paste-api-private-keys-in-codepen/123769/4 "2017-06-06T02:55:59Z")

</div>

To add to the Glitch suggestion that @IsaacAbrahamson mentioned, @deuscode actually did just that last week! Have a look at [this post](https://forum.freecodecamp.com/t/node-js-w-express-storing-api-keys/122570/14) and scroll down to the fifth post for a Glitch template that can be easily remixed!

Good luck! 🙂

---

<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, 9:37am UTC](https://forum.freecodecamp.org/t/paste-api-private-keys-in-codepen/123769/5 "2021-01-17T09:37:33Z")

</div>

Closed on January 17, 2021, 9:37am UTC


