On occasions you may need to store and use confidential data such as API keys etc.
To keep them as secure as possible it is good practice to store these as $_ENV variables rather then coding the keys directly into any API calls or other keys.
Wappler makes this very easy, i will use generic terms in this example.
So, if you need two keys to log into an API action, lets say, called api_public and api_private which represent an api username and password
I select Server Connect settings and open the "Environment" tab
It is convention to define environement variables in upper case
I create two variables and enter their values before clicking save.
NOTE: definition of environment variables are target specific you ensure your keys are entered for both targets. Keys can be different for each target whichnis useful for sandbox type situation and if necessary the API URL can also be added to the environment to allow different endpoints based on target.
Now we have our variables defined, we go to our server action.
We define the variables within the inputs section to declare our ENV variables as inputs
Now they are available to select within any server connect API function.
Here we use them in an external API call
We add an API call step and select Basic authorization in this example.
Thats it, your keys are linked and dont appear directly in the API action json definition for security.