Can an Android-App-Restricted API key be used for Google Distance Matrix? -


i enabled google distance matrix api , restricted key android apps because sending http queries android app receive json response:

key restriction

without restriction, works , expected result. when it's restricted (with package name , sha1) failure message in json object "request_denied" status saying:

this ip, site or mobile application not authorized use api key. request received ip address [ip_addr], empty referer.

from other posts understand distance matrix api must used server key, in new google console there's no option server key; create key , choose restriction above.
firebase console creates server key , can use in android app without restriction.

so how restrict key using distance matrix api android app?

please note android app restriction valid google maps android api v2 , google maps places android. web services (e.g. distance matrix api) not work restriction.

the restrictions work api keys web services ip restrictions.

it supposed web services requests executed on backend servers. if need restrict api key, workaround create intermediate server. android application should send requests intermediate server, intermediate server should send requests google , pass responses app. in case can restrict api key ip address of intermediate server.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -