ResolvedGoogle API Doesnt seem to work.
Tagged: location not working
- This topic has 8 replies, 2 voices, and was last updated 1 year ago by
Althemist.
- AuthorPosts
- October 30, 2022 at 2:17 pm #36061
anchitkawaatra
ParticipantHi Team, please check Ethigreenz.com.
Google Api i setup, billing account seems to be reducing money for confirmation but doesn’t seem activated. I have raised a support ticket there but not sure whom to contact for this.
After entering API in the lafta shipping settings and whitelisting my cloudways server IP. I get the GEOCODE error – Geocoder failed due to: MapsRequestError: GEOCODER_GEOCODE: REQUEST_DENIED: The webpage is not allowed to use the geocoder.
Have been at this for 2 days. I cant even set a branch location because of this. How can i solve this please reply.
November 1, 2022 at 9:16 am #36066anchitkawaatra
ParticipantFound my solution on my own.
November 1, 2022 at 10:01 am #36074Althemist
KeymasterHi anchitkawaatra,
Glad you managed to find the problem. BAsically, you can’t whitelist an IP. It must be explicitly specified domain, not IP.
November 1, 2022 at 10:36 am #36080anchitkawaatra
ParticipantHi, Where do I whitelist the domain specifically? Google says i should restrict the API Key. But in your theme options – shipping area, it asks for secondary API if 1st is restricted. Where can i solve both the issues together so misuse is also prevented?
November 2, 2022 at 11:15 am #36096Althemist
KeymasterYes, you must have 2 API keys. The firs one must be restricted for your domain. The second one should not be restricted. It’s explained below each API key field. The API keys settings can be done in the Google API, not on on your site.
November 2, 2022 at 2:07 pm #36109anchitkawaatra
ParticipantThank you for your reply.
So I made another API key, restrcited to just that Distance Matrix API. Other original API I restrcited to first the *.example.com/* format as given. Map stopped working. Distance was being calculated but no map and location could not be selected.
Then i removed that and add server IP restrcition and removed the domain name one. Still the same. It works only when 1st is not restrcited at all.
November 2, 2022 at 5:10 pm #36116Althemist
Keymaster1. The first key must have the following APIs enabled: Places API, Geocoding API, Distance Matrix API AND it must have HTTP referrer set to your domain.
2. The second key must have the Distance Matrix API and NO restrictions
November 2, 2022 at 5:20 pm #36119anchitkawaatra
ParticipantHi, Thank you for your email.
I have done exactly that. Let me elaborate that here. Please check my website after this – i have kept at these settings –
Enabled all APIs. Linked billing account.
Created Credentials > API. Application Restrcitions for 1st Key => HTTP referrer in following format – *.ethigreenz.com/* and saved it.
No restrcit at bottom radio selection. Saved this. used the API Key as KEY 1 in Lafka Theme Shipping settings general tab. Key in Google console shows green, before restricting the referrer it was yellow warning sign.Created another AP credentials key, no application restriction, but selected restrict and selected Distance Matrix API. and saved. Put this api key in API key 2 in general tab as above.
Now check the website. – Select any cake – go to checkout – map doesnt work.
Shipping 3 methods I have made 0-6km, 6-11km, 11-16km. with minimum order of 400, 800 and 1200 respectively and delivery charge as 10 times the distance.
Please check this. Atleast this will be sorted.
November 3, 2022 at 11:23 am #36128Althemist
KeymasterActually, it is easy to see your site (referrer) is not authorized. Probably wrong settings in the API key configuration. This is from your site’s console:
Google Maps JavaScript API error: RefererNotAllowedMapError
https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error
Your site URL to be authorized: https://ethigreenz.com/ - AuthorPosts
You must be logged in and have valid license to reply to this topic.