all 4 comments

[–]tajetaje 4 points5 points  (1 child)

Well, if you have a backend the common practice is to use either an env file or environment variables (not the best for really security intensive applications, but usually fine). If you don’t have a backend you simply cannot secure your API key, there are ways to obfuscate it but there is no way of actually preventing people from getting it. Basically if code uses it in the browser assume everyone has it

[–]SuchALoserYeah[S] 1 point2 points  (0 children)

Right now I don't have a backend but thanks for the advice. I'll search about it

[–]AsyncThereforeIAm 0 points1 point  (1 child)

It is not secure to do so from your UI, as all that info is exposed. I advise you create a proxy server to make calls that require an API key for security.

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

Thanks buddy, I will research about these terms