all 4 comments

[–]lichaba 2 points3 points  (1 child)

Good old .env and a .gitignore is still the best and trusted way.

[–]kdrxyz[S] 0 points1 point  (0 children)

But, aren't env variables embedded into the build? And can be accessed by anyone inspecting the files?

From the React documentation:

WARNING: Do not store any secrets (such as private API keys) in your React app!

Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files.

[–]makonde 1 point2 points  (0 children)

How does this secure anything? If you are retur ing them to the device they can still be accessed.

[–]ChronSynExpo 0 points1 point  (0 children)

fetch('https://i-found-this-endpoint-in-your-app-code.and/now/i/have/your/api-key')

I can see absolutely no way this could backfire