geolocation APi

-2

I am working on a project with NodeJS and I want to add geoocalization, but when looking for an address, this error appears as I can solve it ?, please

Keyless access to Google Maps Platform is deprecated. Please use an API key with all your API calls to avoid service interruption. For further details please refer to link

    
asked by Brenda Morales 15.12.2018 в 02:01
source

1 answer

0

Welcome to the community,

This is because a few months ago Google changed the policies for the use of its APIs, for this reason it is now necessary to have an api key with which you can make requests to it.

You must create an account in google cloud, generate the key and then make the requests with said key.

By steps it would be:

  • Create the google cloud platform account: link after creating it enter the console link
  • Enable the geocoder api: in the navigation menu on the left, select "apis and services", then on the screen above appears a button that says "enable apis and services" click on that button, in the search box you place "Geocoder" and below it appears, click on it and you will see the "enable" button Well, you enable it.
  • Create a credential for the api: Again go to "apis and services" in the main menu and then to "credentials", click on "create credentials" and then "api key", you will be created a password. api You can use it here, for example: link (replace TUCLAVEAPI with the key that you just generated)
  • The issue is that if someone gets that key you can use it and abuse it (remember that from a number of requests google will start charging, you have to read as I do not remember how is the amount of the fees, but it is a high number of requests you can make, this is more so that it is not abused but for small developments there is not much problem), to restrict a bit the key that you just created you have to click on the edit button that is shown to the right of the key (it is a pencil), there you put a name if it does not already have it and below you will see two tabs, the first "application restrictions" which is in which you will indicate from which ip address the key can be used or a url for example link *, in the second tab "restrictions of api" you will indicate which apis can be used with that key, in this you select "Geocoding Api. "

    With this you would have the key secured, remember that the key must protect it, so you should not upload it to platforms such as github if it is a public repository.

    Any questions in the comments.

    Greetings!

        
    answered by 15.12.2018 в 03:17