# Are API keys in theme components okay?

**URL:** https://meta.discourse.org/t/are-api-keys-in-theme-components-okay/367528
**Category:** Development
**Created:** [May 25, 2025, 12:56pm UTC](https://meta.discourse.org/t/are-api-keys-in-theme-components-okay/367528 "2025-05-25T12:56:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [May 25, 2025, 12:56pm UTC](https://meta.discourse.org/t/are-api-keys-in-theme-components-okay/367528/1 "2025-05-25T12:56:27Z")

</div>

If I were to make a TC that requires the admin/moderator to input an API key as part of a theme setting, would that be safe? I know I could do a plugin which is safer, but a plugin seems like much more work.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 25, 2025, 1:01pm UTC](https://meta.discourse.org/t/are-api-keys-in-theme-components-okay/367528/2 "2025-05-25T13:01:45Z")

</div>

Theme settings are available to the client JS app, so that means any visitor to your site could check the source code to see them. You almost certainly don’t want to put an API key there.

The exception would be for API keys that are _designed_ for client-side use, and therefore aren’t a concern if anyone gets access to them (e.g. Giphy, Google Maps embeds, etc.)

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [May 25, 2025, 1:02pm UTC](https://meta.discourse.org/t/are-api-keys-in-theme-components-okay/367528/3 "2025-05-25T13:02:46Z")

</div>

Got it. A plugin’s what I’ll go with.  
Thanks!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 24, 2025, 1:03pm UTC](https://meta.discourse.org/t/are-api-keys-in-theme-components-okay/367528/4 "2025-06-24T13:03:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
