# How to set a variable in the header (API connector plugin)

**URL:** <https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310>\
**Category:** APIs\
**Created:** [February 5, 2023, 1:25pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310 "2023-02-05T13:25:29Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoke](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hoke/32/150258_2.png) [@hoke](https://forum.bubble.io/u/hoke)\
**Post date:** [February 5, 2023, 1:25pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/1 "2023-02-05T13:25:30Z")

</div>

Hello,  
I want users to input their own API key.  
Since the authentication is made via Bearer API-KEY, I’d need to set the key in the header as a variable.

Picture here:

 ![copybrain-Bubble-Editor](https://us1.discourse-cdn.com/bubble/original/3X/0/3/0362d9ac721e85d1e5160da41cf5309176e30392.png)

How do I do this?

---

<div class="post-metadata">

**Author:** ![juicebox](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@juicebox](https://forum.bubble.io/u/juicebox)\
**Post date:** [February 5, 2023, 1:35pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/2 "2023-02-05T13:35:55Z")

</div>

Untick ‘Private’.

---

<div class="post-metadata">

**Author:** ![hoke](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hoke/32/150258_2.png) [@hoke](https://forum.bubble.io/u/hoke)\
**Post date:** [February 5, 2023, 2:15pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/4 "2023-02-05T14:15:40Z")

</div>

Okay I got it thanks.  
But by unticking it will the key be exposed somehow? Is it still safe like before?

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [February 5, 2023, 2:56pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/5 "2023-02-05T14:56:57Z")

</div>

A long time ago I wondered the same thing, the vocabulary is a little worrying, but what it actually means to uncheck “Private” is to allow that field to be visible from the Bubble Editor. In other words, it means you can access this field in workflows (as well as other places)

That answers your question. Allow me to add the following…

Are you asking for people’s API keys for some 3rd party service and exposing this to your Bubble app? If that’s the case, **you must proceed with excess caution** You should make absolutely sure that whatever workflow is taking that API key as a source should be 100% run on the client side. If that ever enters your server and stored (Even temporarily. It’s existence in server logs counts) then you’re going to run into trouble if ever you’re audited for **PII compliance**. Furthermore, if your app ever gets breached and even one person’s API key gets exposed, well - **it would be really bad**

See these links:

> **[What Is Personally Identifiable Information (PII)? Types and Examples](https://www.investopedia.com/terms/p/personally-identifiable-information-pii.asp)**
>
> Personally identifiable information (PII) is information that, when used alone or with other relevant data, can identify an individual.

> **[Official PCI Security Standards Council Site](https://www.pcisecuritystandards.org/)**
>
> A global forum that brings together payments industry stakeholders to develop and drive adoption of data security standards and resources for safe payments.

> [@User input for API calls in Server Logs need to be PCI compliant](http://forum.bubble.io/t/user-input-for-api-calls-in-server-logs-need-to-be-pci-compliant/236115/10):
>
> Identify and list all bespoke and custom software. Requirement 6.3.2 specifies that in order to manage vulnerabilities and patches, entities are now required to identify and list all of their bespoke and custom software, including any third-party software that has been incorporated into the organization’s bespoke and custom software. The inventory should cover all “payment software components and dependencies, including supported execution platforms or environments, third-party libraries, servi…

Note: I’m not exactly sure what law or regulation a leak of an API key would break, but it’s definitely something you want to avoid even appearing in your logs

---

<div class="post-metadata">

**Author:** ![hoke](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hoke/32/150258_2.png) [@hoke](https://forum.bubble.io/u/hoke)\
**Post date:** [February 6, 2023, 12:43pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/6 "2023-02-06T12:43:19Z")

</div>

I understood that whatever workflow that is taking the API key as a source should be run on the client side (I believe that’s a paid feature for Bubble, right?), but can I store the API keys in the database? I can’t expect user to input the API key every time they want to use the service.

Thanks for the other resources!

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [February 6, 2023, 1:25pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/7 "2023-02-06T13:25:01Z")

</div>

Hoke…

I would 10000% say do NOT store the api keys… in fact most api services would highly discourage such a practice

You are opening yourself to a lot of trouble (and hurt!)

---

<div class="post-metadata">

**Author:** ![hoke](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hoke/32/150258_2.png) [@hoke](https://forum.bubble.io/u/hoke)\
**Post date:** [February 6, 2023, 1:38pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/8 "2023-02-06T13:38:02Z")

</div>

ok… then I need to find a way to use the keys without storing them. Are you able to point me out to any resource? Thanks!

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [February 6, 2023, 2:25pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/9 "2023-02-06T14:25:15Z")

</div>

The point is you should NOT store people’s api keys , in other words you should not have access to them. You should ask for it every time. From my experience, this is a bad idea

---

<div class="post-metadata">

**Author:** ![hoke](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hoke/32/150258_2.png) [@hoke](https://forum.bubble.io/u/hoke)\
**Post date:** [February 6, 2023, 2:40pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/10 "2023-02-06T14:40:45Z")

</div>

Okay, I got it, I will ask users to input it every time.

By using backend workflows will the data be 100% secure?

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [February 6, 2023, 2:45pm UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/11 "2023-02-06T14:45:34Z")

</div>

That’s just my experience and two cents for you. Maybe someone knows a good way to do this but I don’t, unfortunately. Personally I’d stay away from that

---

<div class="post-metadata">

**Author:** ![hoke](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hoke/32/150258_2.png) [@hoke](https://forum.bubble.io/u/hoke)\
**Post date:** [February 7, 2023, 6:30am UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/13 "2023-02-07T06:30:47Z")

</div>

New question: can I at least save it as the state of some element? So that the user doesn’t have to input the key multiple times in the same session.

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [February 7, 2023, 8:33am UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/14 "2023-02-07T08:33:37Z")

</div>

Yes that is okay because it’s not coming in contact with your server 🙂

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [February 7, 2023, 8:34am UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/15 "2023-02-07T08:34:42Z")

</div>

Nothing is 100% secure, so that’s why I believe storing something such as an unencrypted API key in your database, is a bad idea

---

<div class="post-metadata">

**Author:** ![hoke](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hoke/32/150258_2.png) [@hoke](https://forum.bubble.io/u/hoke)\
**Post date:** [February 7, 2023, 10:43am UTC](https://forum.bubble.io/t/how-to-set-a-variable-in-the-header-api-connector-plugin/245310/16 "2023-02-07T10:43:48Z")

</div>

Nice! Thank you
