Does the API key need to be public to be used? (Discussion) #247
-
Hi there, I've noticed that you get a hydration error when trying to use a non-public API key in your .env file (in Nextjs, but I imagine this would happen everywhere). I'm fairly certain I've seen that this is required, but I can't find the documentation stating as much anymore. Is this by design, and what is the recommended way to protect your API? Currently, I am setting website restrictions on the API key via Google Cloud, but want to see what everyone else is doing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, there is no way to load the Google Maps Api in the browser without also providing the API key in the browser (which is public for everyone). Basically there are three ways to protect your key and usage:
|
Beta Was this translation helpful? Give feedback.
Yes, there is no way to load the Google Maps Api in the browser without also providing the API key in the browser (which is public for everyone).
Basically there are three ways to protect your key and usage: