ridvan
ridvan

Reputation: 743

Api key request denied

I am trying do that drawing path between two location,when I try do this I got a error this. I shared below my url and error.I created Android api key,wht I got request denied error from google api

url: https://maps.googleapis.com/maps/api/directions/json?origin=41.050399,28.940599&destination=41.1119857,29.0186137&sensor=false&mode=driving&alternatives=true&key=AIzaSyB9LW3JNai1tGYtSVZrRGMGeJ71q7Y3DbA

json:{ "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 78.186.62.169, with empty referer", "routes" : [], "status" : "REQUEST_DENIED" }

Upvotes: 0

Views: 1310

Answers (2)

xomena
xomena

Reputation: 32158

Directions API web service requires a Server API key, not Android API key. Please look at the documentation:

https://developers.google.com/maps/documentation/directions/get-api-key#get-an-api-key

Upvotes: 1

JoaoFRF
JoaoFRF

Reputation: 25

I dont think that is the correct way of using it, try something like this

https://maps.googleapis.com/maps/api/js?key=<YOUR_API_KEY>&callback=initMap

and if it is in a variable then u will need " " like

src="https://maps.googleapis.com/maps/api/js?key=<YOUR_API_KEY>&callback=initMap"

Upvotes: 1

Related Questions