This IP, site or mobile application is not authorized to use this API key - google-api

I am using https://maps.googleapis.com/maps/api/geocode/json? link with server key and user IP to find the latitude and longitude of any address, when I'm trying I find the error as
I have a server access key from google and I have put my server's IP address in the their white list.
The URL that I am trying to access via PHP CURL is:
https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true&key=XXXXXXXXXXXX
The result that I am getting:
Array ([error_message] => This IP, site or mobile application is not authorized to use this API key. [results] => Array ( ) [status] => REQUEST_DENIED)
Is there anything that I need to configure.The geocoding API is also switched on.

I had the same issue and I found this.
On the url, it requires the server key in the end and not the api key for the app.
So Basically, you just add the server key in the end of the URL like this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=SERVERKEY
Now, to obtain the server key, just follow these steps:
1) Go to Developer Console https://code.google.com/apis/console/
2) In the Credentials, under Public API Access, Create New key
3) Select the server key from the option.
4) Enter your IP Address on the field and if you have more ip addresses, you can just add on every single line.NOTE: Enter the IP Address only when you want to use it for your testing purpose. Else leave the IP Address section blank.
5) Once you are done, click create and your new Server Key will be generated and you can then add that server key to your URL.
Last thing is that, instead of putting the sensor=true in the middle of the URL, you can add it in the end like this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true
This will definitely solve the issue and just remember to use the server key for Places API.
EDIT
I believe the web URL has changed in the past years. You can access developers console from here now - https://console.developers.google.com/apis/dashboard
Navigate to developers console - https://console.developers.google.com/ or use the link from details to navigate directly to API dashboard.
Under developer console, find Label from the left navigation panel
Select project
Choose Credentials from the left Navigation panel
You could create credentials type from the Top nav bar as required.
Hope this answer will help you and other viewers. Good Luck .. :)

Choose key
API Restriction tab
Choose API key
Save
Choose Application Restriction -> None
Save

In addition to the API key that is assigned to you, Google also verifies the source of the incoming request by looking at either the REFERRER or the IP address. To run an example in curl, create a new Server Key in Google APIs console. While creating it, you must provide the IP address of the server. In this case, it will be your local IP address. Once you have created a Server Key and whitelisted your IP address, you should be able to use the new API key in curl.
My guess is you probably created your API key as a Browser Key which does not require you to whitelist your IP address, but instead uses the REFERRER HTTP header tag for validation. curl doesn't send this tag by default, so Google was failing to validate your request.

The Google Places API does not currently support Android or iOS keys generated from the Google APIs Console. Only Server and Browser keys are currently supported.

You're trying to use an API KEY which you restricted in a way that won't allow this action.
According to Google:
Note: If you need to call web, web service, and/or mobile APIs from the same (client-side) app, create and restrict multiple keys.
So the right thing to do is to create another API KEY, and choose the correct restrictions for this matter. In your case, choose "IP addresses" (under "Application restrictions"), and use "ADD AN ITEM" to add your server ip.
Notice that leaving a blank list won't work, and will result in google changing your restrictions to "None".
Also, don't forget to add the relevant APIs under "API restrictions" (in your case "Geocoding API").
One last thing - Google is blocking the use of this API until you link your app to Google Cloud Billing Account. So if you didn't do it yet, once you successfully get a response, it will say you have to do it first (it has a free starting package).

Google Place API requires the referer HTTP header to be included when making the API call.
Include HTTP header "Referer:yourdomain.com" and this should fix the response issues.

You create an key with out referer
dont enter the referer address

For the latest version of the API the exact opposite seems to be true for me.
When calling the url https://maps.googleapis.com/maps/api/geocode/json?address=<address>&key=<key> I was getting the following error
You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account
Once I switched the order to https://maps.googleapis.com/maps/api/geocode/json?key=<key>&address=<address> it worked fine.
Note that the error message received above was the message I got when going directly to the URL in the browser. When I called the API from a software program I received an HTML response with basically the following message:
We're sorry... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.

Also, the corresponding API should be enabled for the given project
https://console.developers.google.com/apis/library?project=projectnamehere

For iOS or Android apps, the key needs an extra privilege granted.
Go to the Google Console -> APIs and Services -> Library. Tap the Places library for your platform and then tap Enable.
See https://developers.google.com/maps/gmp-get-started#enable-api-sdk

The reason this error is occurring because of the restrictions you have added when you create add the sha1 fingerprint on google cloud console , remove the fingerprints from android or ios then save .(the ip of that mobile phone will no longer be restricted)

Authentication, quotas, pricing, and policies
Authentication
To use the Directions API, you must first enable the API and obtain the proper authentication credentials. For more information, see Get Started with Google Maps Platform.
Quotas and pricing
Review the usage and billing page for details on the quotas and pricing set for the Directions API.
Policies
Use of the Directions API must be in accordance with the API policies.
more know : visit:--- https://developers.google.com/maps/documentation/directions/start?hl=en_US

url = https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving&key=AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY
add only in AppDelegate like
GMSServices.provideAPIKey("AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY")
and remove the key in this url.
now url is
https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving

Disable both direction api and geocoding api and re-enable.
it works for only 5-10 seconds and than automatically disabled itself.
it means you have only 5-10 sec to test you assignment.

Related

Google javascript api client, automatically login to same account without popup

Is there a way to automatically authenticate the google javascript api client, without user interaction?
Something like this:
User loads webpage -> webpage automatically signs in into a predefined user account -> api calls get executed
Basically i want to prevent the popup where you have to select an account and sign in to it. As the account which will be signed in is always the same.
EDIT:
pinoyyid answer looks promising and is what im looking for. But this only works if the user has signed in with an account at least once, if im not mistaken.
Now i dont want to use an account supplied by the user, but a predefined account which i am the owner of and sign this account in.
Im not entirely sure if this is even possible, as i have to provide the password/some authentication code to google and somehow do this in a secure way.
Use Case: The website will create a Youtube Broadcast via the Youtube Data/Livestream API for the specified account.
Yes you can do that. Referring to https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow
there are three pieces of information that will get you where you want to be:-
The OAuth URL can include a login_hint which is the email of your intended user
The OAuth URL can also include prompt=none which will do its work silently
This all needs to run in an iframe because this is based on origins and redirects.
==EDIT==
If the requirement is for a browser client to connect to a Google Account other than that of the browser user, then this is not possible. It's kinda obvious really that to do so would require a credential in the browser which by definition is not a secure environment.
The approach I would take would be to use a service such as Lambda or Google Cloud Functions (or whatever marketing name they have this week) to create a proxy for the corresponding Google API using a credential stored server-side.

on click .. Suspicious link error in gmail(laravel)

When a user signs up on our website, they get an email verification link, but whenever they try to click on any link in that mail, they get the alert error message:
Suspicious link
This link leads to an untrusted site. Are you sure you want to
proceed?
We are using the sendgrid mailer system and we are certified to https.
Where is the problem coming from?
This is mostly in newsletters(Mailers), we need to verify the domain in Google
For authenticating domain using the steps below:
Go to postmaster.google.com.
On the bottom-right, click the + button.
In the box that pops up, enter your authentication domain.
Next, prove that you own the domain by adding a DNS TXT or a DNS CNAME record.
For reference: https://productforums.google.com/forum/#!topic/apps/xSV6J-Nmkmc;context-place=forum/apps
Also it happens when we have https(ssl) but we are using the link http
We were recently having this issue in our account verification emails as well. Verifying our domain through DNS records as recommended by Google was not enough.
The ultimate solution for us was ensuring that every link has an alt tag with descriptive text.
Verify!
Please check once for a DNS record. You can check it from below url
https://mxtoolbox.com/SuperTool.aspx
And also check for the DMARK record which is found in your mx records or not.
Go to sendgrid.com > Settings > Sender Authentication and configure DNS

Can't add domain for push notifications in google developers console

I've created a new application in google developers console, my app is using the Google Calendar API and I want to be able to get push notifications on changes in the calendar. I've added and verified my domain in Web Master Tools, when I try to add the domain in the push notifications section in the console I get an error:
Error
You do not have access to the following domain: ***
I tried to do that with another application (with different google account), and I encounter the same problem, It seems like google are having a problem because it's not the first time I'm doing it and it should be pretty simple, any suggestions?
In order to add a domain to the "Push notifications" you must verify your domain in webmaster tools with a "https://" prefix, otherwise it won't work because push notifications in Google works only with "https://", that's why you need to verify it in webmaster tools with "https://" so Google can verify you have an SSL.
This will be helpful incase if you are using subdomains.
https://support.google.com/webmasters/answer/35163?hl=en&ref_topic=4564314&vid=1-635796479292102918-3720802661
When you verify that you own a domain (such as example.com using DNS verification, you've proven that you have control of the domain, all its subdomains, and all sites in those subdomains.
Similarly, if you have verified http://www.example.com (using any verification method), and then add http://www.example.com/test, you will be automatically verified as an owner of http://www.example.com/test. You'll remain a verified owner of the subdirectory even if you later delete http://www.example.com from your Search Console account.

Google place API request denied issues

I am trying to use Google places api to search the location. But Unfortunately I am getting only 1 message in responce is REQUEST DENIED. I have created new API key, but the API ACCESS Menu shows some warning icons as shown in below image does it created any issues or any other issues belonging to API key ?
Please let me know how to overcome this issue.... thanks in advance!`
my request string is this
You should also never post your API Key on the Internet like in your request string above to prevent your key from being abused. Your API Key should be kept private like a password as any usage of your key will be logged against your account.
The request above works fine using my API Key, I would suggest generating another API Key on the API Access page of the APIs console. Also make sure that you have enabled the Places API under services, instructions are here.
The notification icons are there to notify you that you have not enabled billing on your account yet.
i have the same error. the error was resolved by append &sensor=false at the end of API
I've had this issue, turns out using the key for Android applications (the one used for the maps API) is wrong. I needed to create a key for browser applications. Once I used the browser key instead of the Android key everything worked fine.

Where can I get Google developer key

I am working on Google API like chat, contacts and so on...
I am stuck on developer_key as mentioned in gdata doc.
You can get this at https://code.google.com/apis/console:
'developer_key' => ''
I have already:
// OAuth2 Settings, you can get these keys at https://code.google.com/apis/console
'oauth2_client_id' => '',
'oauth2_client_secret' => '',
'oauth2_redirect_uri' => ''
Where can I find developer key?
I found some thing like this
http://code.google.com/apis/youtube/dashboard/gwt/index.html
But I understand this to be only for youtube.
It's the API key as listed under 'API Access', the 'Simple API Access' box.
First activate Google+ API, then you will get "Simple API access" box, from there you can get
developer key as API key
https://code.google.com/apis/console/?api=plus
or read this: http://code.google.com/p/google-api-php-client/wiki/OAuth2
Update Nov 2015:
Sometime in late 2015, the Google Developers Console interface was overhauled again. For the new interface:
Select your project from the toolbar.
Open the "Gallery" using hamburger menu icon on the left side of the toolbar and select 'API Manager'.
Click 'Credentials' in the left-hand navigation.
Alternatively, you can click 'Switch to old console' under the the three-dot menu (right side of the toolbar), then follow the instructions below.
For the NEW (edit: OLD) Google Developers Console:
You get your 'Developer key' (a.k.a. API key) on the same screen where you get your client ID/secret. (This is the 'Credentials' screen, which can be found under 'APIs & auth' in the left nav.)
Below your client ID keys, there is a section titled 'Public API access'. If there are no keys in this this section, click 'Create new Key'. Your developer key is the 'API key' specified here.
Update no 3:
You can get a Developer_Key from here Get your Google Developer Key
Check this tutorial
{select as answered, if it answered.}
Update no 2:
"API key" is the DEVELOPER_KEY
if you check this code reference,
it states
Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the Google APIs Console http://code.google.com/apis/console#access`
Wiki on step by step to get API Key & secret
Update:
Developer API Key! probably this is what you might be looking for
http://code.garyjones.co.uk/google-developer-api-key
OR
If say, for instance, you have a web app which would require a API key then check this:
Go to Google API Console Select you project OR Create your project.
Select APIs & Auths
API Project from the Dropdown on the left navigation panel
API Access
Click on Create another Client ID
Select Service application refer it here
The Service application that you have created can be used by your Web apps such as PHP, Python, ..., etc.
2017 Update
Open Google API - https://console.developers.google.com
Go to Credentials.
Click on the 'Create Credentials' button. At time of writing it's currently a blue coloured dropdown.
Select API Key.
You should get a dialog from where you can copy this API key to use in your project. Hope this helps.
In the old console layout :
Select your project
Select menu item "API access"
Go to the section below "Create another client ID", called "Simple API Access"
Choose one of the following options, depending on what kind of app you're creating (server side languages should use the first option - JS should use the second) :
Key for server apps (with IP locking)
Key for browser apps (with referers)
In the new cloud console layout :
Select your project
Choose menu item "APIs & auth"
Choose menu item "Registered app"
Register an app of type "web application"
Choose one of the following options, depending on what kind of app you're creating (server side languages should use the first option - JS should use the second) :
Key for server apps (with IP locking)
Key for browser apps (with referers)
In case of both procedures, you find your client ID and client secret at the same page. If you're using a different client ID and client secret, replace it with the ones you find here.
During my first experiments today, I've succesfully used the "Key for server apps" as a developer key for connecting with the "contacts", "userinfo" and "analytics" API. I did this using the PHP client.
Wading through the Google API docs certainly is a pain in the #$$... I hope this info will be useful to anyone.
Please use Google API console
Create a new project
For the created project goto API access
There you will find your Client ID and Secret.
And the API key in the last is your developer key.
Recent Update July 2017:
Go to Google Console
Click on Left most top panel and click credentials.
In the API keys table, you will find the API key in the key column.
API Key is your developer key.
Hit https://www.googleapis.com/webfonts/v1/webfonts?key= in your browser by enabling web fonts api and you will see result.
Refer this blog http://code.garyjones.co.uk/google-developer-api-key/ for more information
I explored the google docs and found that developer key and api is same thing.
in https://code.google.com/apis/console/ , in SERVICES, turn on YOUTUBE API, then click API ACCESS in the left menu.
"Public API access" the key generated there is the key you got to paste into your public static final String DEVELOPER_KEY as part of this writing 26.12.2013
It is not the clientID but you got take the steps mentioned above to obtain one and generate the public api access key.
Go to https://code.google.com/p/google-api-php-client/wiki/OAuth2
Scroll down to where it says 'Visit the Google API Console to generate your developer key, OAuth2 client id, OAuth2 client secret, and register your OAuth2 redirect uri. Copy their values since your will need to input them in your application.'
Click on the 'Google API Console' link.
When it pops up and says 'Welcome to the new Google Developers Console! Prefer the old console? Go back | Dismiss' Click on 'GO BACK'
If you are only calling APIs that do not require user data, such as
the Google Custom Search API, then API keys might be simpler to use
than OAuth 2.0 access tokens. However, if your application already
uses an OAuth 2.0 access token, then there is no need to generate an
API key as well. Google ignores passed API keys if a passed OAuth 2.0
access token is already associated with the corresponding project.
Note: You must use either an OAuth 2.0 access token or an API key for
all requests to Google APIs represented in the Google Developers
Console. Not all APIs require authorized calls. To learn whether
authorization is required for a specific call, see your API
documentation.
Reference: https://developers.google.com/console/help/new/?hl=en_US#credentials-access-security-and-identity
tl;dr
Developer Key = Api Key (any of yours)
find it in Google Console -> Google API -> Credentials
You should be able to generate a Youtube API key there.
The recommended way to authorize your API call is to use OAuth 2.0 (without API key), as pointed by the documentation an API key is only necessary when using OAuth 1.0 credentials.
The API key for your application can be found in the Google APIs Console in API Access > Simple API.

Resources