I am using a react app for frontend and salesforce for backend. I want to hide an API key from the users.
I got some solution like .env variables but if I commit the changes then how code will work as the key is in my machine only. I want a method to hide in such a way that user do not have to do something extra just download the package. Is there any method in salesforce or react hide an API key?
2
Answers
In Salesforce, use Named Credentials to securely store API keys and other sensitive information. Named Credentials in Salesforce provide a secure and centralized way to store authentication information.
You can simply put the env file on server or deployment environment and put the file in gitignore and use it locally
on prod server it will pick from deployment environment