Are Firebase functions a safe place to store API keys for a React App? As an example, see the following template for an axios API call in a Firebase Cloud function:
edit: added text code snippet. The question whether or not it is secure to store the API key directly in this snippet, given it's a firebase cloud function.
exports.getAlphaData = functions.https.onRequest((request, response) => {
const fetchAlphaData = async () => {
// Axios Call
const result = await axios(
'https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=SPY&XXXXXX',
);
// Expressjs Respond
response.send(result.data);
};
fetchAlphaData();
});
If this function were defined in the React App that would expose my API keys. React official docs among other sources say never use .env files for sensitive data, so I am setting aside that method for the keys as well. Where is the best place for a raw API key to actually reside within a full stack app?