Score:0

Restrict IP addresses Google APIs and Accesing from GKE (Google Kubernetes Engine) Request Denied

bl flag

I created API Keys to enable Geocoding API, Maps JavaScript API and Places API with Restrict IP with Cloud NAT IP. My API Keys access from Kubernetes on GCP (Google Kubernetes Engine/GKE), when im test curl get response request denied because response from from IPV6 Address.

curl --location --request GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Wonogiri&types=&key=MY-API-KEY'
{
   "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address IPV6_ADDRESS, with empty referer",
   "predictions" : [],
   "status" : "REQUEST_DENIED"
}

But im curl to ifconfig.me the response is IP Cloud NAT (34.87.xxx.xx). Im very confused.

restrictions from ip address enable 3 google api

Sanjay M. P. avatar
mr flag
were you able to resolve the above issue ? running into the same
Score:0
eg flag

Based on the response from the API, I suspect you have to set an http referrer header.

curl --referer Referer_URL \ 
   --location \ 
   --request GET \ 
   'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Wonogiri&types=&key=MY-API-KEY'

I would check the restrictions because you might have enabled "website" restrictions and so the referrer is required.

If you have IP restrictions, make sure to add the IP to the list and to save the api key. It should work instantly.

The IP addresses should be the external IP addresses of the nodes in the cluster.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.