0

I followed this tutorial here http://www.albertgao.xyz/2018/12/15/how-to-add-official-google-sign-in-to-your-react-application/

How can I safely store the api key? I have read some instructions about using .env folder, but you can view them with devtools.

I know with other API keys, we can store them on the server. However, I'm not sure how I can do this for Google Sign-In

Punisher
  • 654
  • 5
  • 21

1 Answers1

0

If you want to store the key then you have to store it in server or db. There is no way you can store API key in frontend where it will be secure. You can use firebase (online db) to store your key.

If you still want to do it in the frontend, there is one way of encrypting the key in frontend and then decrypt it in the backend...but this will not be an efficient approach as for every call u have to decrypt the data at least in the backend. This will affect your application performance

anant
  • 79
  • 2
  • 10