2
votes

I'm having trouble getting my Google Static Map API to work.

I see this message in the console:

"This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console: https://console.developers.google.com/apis/api/places_backend?project=_ For more information on authentication and Google Maps Javascript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key"

But I've already enabled the API and generated credentials (API key). The test URL that google gives in the Static API example works in a browser, but not from my app.

Inside my app I'm building this link from an example. It works with the API key in the example, but not with mine. It DOES work with my info in the browser which is perplexing. I don't think I have the wrong API service so I'm not sure where I've gone wrong.

Docs Consulted:

https://developers.google.com/maps/documentation/static-maps/

I tested this link with lat and long of my house and my API key (doesn't work), DOES with original tutorial API Key and my lat, long

https://maps.googleapis.com/maps/api/staticmap?center=${lat},${lng}&zoom=14&size=800x150&key=${process.env.MAP_KEY}&markers=${lat},${lng}&scale=2

Google API Dashboard Google API Dashboard

And here's a shot of the Credentials tab: enter image description here

1

1 Answers

0
votes

I found the answer on Slack. It's really difficult to keep all of the Google Map APIs straight. Even when accessing the URI structure I listed above you still have to enable the API below, not static maps.

https://developers.google.com/maps/web/