I'm trying to use the Google Places API in my application. For that I need to generate Server Key.
I used my device IP address to generate a Server Key. My app works only in my device. If I use some other device I get an error:
{
"error_message" : "This IP, site or mobile application is not authorized to use this API key.",
"predictions" : [],
"status" : "REQUEST_DENIED"
}
Could you please help me in this regards. How to generate Server key which works for all devices.
To generate the server key that works for all devices,
Authentication
The Google Places API uses an API key to identify your application. API keys are managed through the Google APIs Console. You'll need your own server API key before you can begin using the API. To activate the Places API and create your key:
- Visit the Google APIs Console at https://code.google.com/apis/console
and log in with your Google account.
- A default project called API Project is created for you when you
first log in to the APIs Console. You can use the project, or create
a new one by clicking the API Project button at the top of the window
and selecting Create. Maps API for Business customers must use the
API project created for them as part of their Places for Business
purchase.
- Click the Services link in the left-hand navigation panel.
- Click the status switch (the on/off button) next to the Places API
entry. The switch slides to ON.
- Click API Access in the left-hand navigation panel.
- Click Create new Server key.
- Enter one or more server IP addresses if you wish to restrict the
servers that can send API requests.
- Click Create. Your API key appears under the heading Key for server
apps (with IP locking).
CHECK:
how-do-i-get-a-google-places-api-key-for-my-android-app.
NOTE:
To Create new Server key -
Enter one or more server IP addresses if you wish to restrict
the servers that can send API requests.
The documentation clearly says:
You'll need your own server API key before you can begin using the API
You cannot access this api from your device, you suppose to access it from your server and path the information to your users.
For complete documentation: - https://developers.google.com/places/documentation/
Try to create a new Places API key. When creating the key choose the server but leave the IP field blank (so as to allow any IP address).
Notify and vote up if it works.