Ask coding questions

← Back to all posts
How to hide API keys in html when they removed .env

Since i cant use .env anymore how am i supposed to hide API keys and other stuff i dont want to be seen by the user on my website?


You can't hide anything in HTML. When a client opens your page, your HTML is sent to the client, which means they can read anything that is sent to the client. never trust the client. Your best option is to hide something in the server and have the client request it in a secure way.


At the sidebar of your repl, click on the padlock button and there you can enter your keys and values.
That is your .env file content
You can then use the same functions to get that hidden data that you use for the .env file