How to give referrer url for localhost in google map api?

前端 未结 4 929
太阳男子
太阳男子 2021-02-07 00:14

I am using google map geocode api for getting city,country,and state from zip code. I have restricted the API key to only respond to requests from allowed URLs.

It works

相关标签:
4条回答
  • 2021-02-07 00:38

    I had that problem today, just typed "localhost" on the credentials part and it worked.

    0 讨论(0)
  • 2021-02-07 00:42

    localhost:52200/* worked for me in July 2019. Didn't need explicit protocol like http or https.

    0 讨论(0)
  • 2021-02-07 00:49

    Try to create an API key again. I would suggest you to follow Get a Key/Authentication.

    NOTE:

    Google Maps APIs are available for Android or iOS apps, Web browsers, and via HTTP web services. APIs in each platform require a specific type of key. The Google Maps JavaScript API will only work with a Browser key. APIs of the same platform can use the same key.

    Also, check Registering authorized URLs to validate if you are entering a correct format URL.

    For example:

    http://localhost or http://localhost:[PORT_NUMBER]

    Hope this helps!

    0 讨论(0)
  • 2021-02-07 01:05

    http://localhost wasn't enough for me, but adding an asterisk worked: http://localhost/*

    0 讨论(0)
提交回复
热议问题