Unable to generate digital signature for google static street view API - google-api

I am trying to use the google static street view API to get an image of a property. The docs for the API state that I need to use a "digital signature": https://developers.google.com/maps/documentation/streetview/overview
I am trying to generate a signature, but the guide google provides doesn't seem to make much sense. These are the docs I am reading in regards to generating a signature: https://developers.google.com/maps/documentation/streetview/digital-signature#get-secret
But when I navigate to this page it doesn't seem to show the things mentioned in the docs that allow you to generate secrets.

When using Street View Static API or Maps Static API, the documentation specifically says:
"We strongly recommend that you use both an API key and digital signature, regardless of your usage."
Regarding your question, you seem to be on the Metrics page instead of the Credentials page.
Now on how to generate a digital signature, let me just quote the guide from the Documentation and add some additional details to help you.
Go to the Google Maps Platform Credentials page in the Cloud Console.(You should be on the one I circled on the above image)
Click the project drop-down and select the same project you used when you created the API key for the Street View Static API.
Select the APIs drop-down and select Street View Static API.
Scroll down to the Secret Generator card. The Current secret field contains your current URL signing secret.(If there's no current one, Generate Secret button will be the only one you'll see).
The page also features the Sign a URL now widget that allows you to automatically sign a Street View Static API request using your current signing secret. Scroll down to the Sign a URL now card to access it.
To get a new URL signing secret, select Generate/Regenerate Secret. If there's an existing one, the previous secret will expire 24 hours after you've generated a new secret. After the 24 hours have passed, requests containing the old secret no longer work.
Since your question is only about generating digital signature, you'll have to read the Documentation for more details and for the next steps.
Hope this helps.

I couldn't figure this out, but turns out you don't actually need to use a signature to access the API.

Related

Recaptcha secret key, where is it in my Google Cloud Recaptcha account?

I am attempting to setup a google recaptcha on my site and the plugin I am using is asking for the site key AND a secret key. No idea what a secret key is, I cannot find it in my settings anywhere in Google Cloud. Any help is greatly appreciated.
Try going to https://g.co/recaptcha/v3 and use that UI to set up your reCaptcha. With that process I was provided with two keys, a site key for the frontend and a secret key for the backend.
Google seems to have a couple of different ways to set up recaptcha and the documentation is out of sync with reality so there are many dead ends to get lost in. I spent a long time in the Google Cloud Platform and it was useless.
Even I faced the same confusion after trying to implement it by reading some online tutorials. The first confusion was why my Google Cloud console called it CAPTCHA "Enterprise". But I will leave that exploration to you, as it doesn't matter in our case.
But I was finally able to get it to work. I found the secret under,
Legacy reCAPTCHA secret key
It is now possible to find your secret key in the Google Cloud Console
If you go to the details page of your site key, the secret key will be available at the bottom.
The ReCAPTCHA Enterprise version does not use a secret key. You can still use recaptcha 3 or 2 and generate a api and secret key here:
https://www.google.com/recaptcha/admin/create
Enterprise ReCaptcha is a bit different than the standard one.
Login to Google cloud platform and select your project from the top menu.
Search for reCAPTCHA Enterprise in the search box.
On that screen you can definite Enterprise keys (public site key) and their settings (allowed domains, etc...)
In order to create a secret key, go to: APIs and services menu. Select 'Credentials' and define a new API key (secret key).
Hope that helps.

Google Url shortner API not loging Short link history with API key

I am using the Goo.gl API to shorten some links.
The calls to the POST method are working good and the short URLs are working also, but I have a question regarding the short link history.
If I create a short url from the goo.gl page it will be stored there for me to see and see all the analytics associated to it, but if I generate it via the API POST using my API Key, the link will not be added to my history and I can't see any data related to it in the Goo.gl page. Is there anyway to access that information?
This is the difference between public and private.
The Url Shortener API is technically a public API. Which means that you don't need to be Authenticated in order to use it. This is why a public API key works. However when you are using a public api key the api doesn't know who you are personally.
Solution: What you need to do is to switch to Oauth2. Authenticate your application get an access token and instead of sending the API key send the access_token. Then when links are created they should be added to your account and you will get analytics for them.

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

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.

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.

Using ACS with Windows Phone

I'm lost. I'm developing a Windows Phone 7 app and I want to do the following:
I want to use Facebook, Live ID, Google and Yahoo to let user sign in my app. And also, it they don't have any of those account I will need to implement a sign up interface on Windows Azure.
I also need to store some ID from user signed in my app. For example, Facebook returns an ID for that user. But Google, Live ID and Yahoo! returns another ID. I will store this on a user table with these columns:
ID | Sing-IN-Type | ID-returned
ID: Primarty Key.
Sing-IN-Type: Foreign key to a table with Facebook, Google, etc. names.
ID-returned: ID returned by those webs.
I've read about ACS v2 and I'm not sure it will fit with my requisites. What do you think?
The ACS team has posted a sample that demonstrates how to implement federated auth in a phone app using the silverlight browser control:
http://acs.codeplex.com/wikipage?title=ACS%20Windows%20Phone%20Sample&referringTitle=Samples
The sample doesn't parse the token to extract the claims you're after, but it wouldn't take much code to do it.
After logging in, the application caches the token returned from ACS in a RequestSecurityTresponseStore, which is a member of the MainPage. There are Simple Web Token (SWT) handlers included in the DPE.OAuth project that you can make use of. In the context of MainPage.xaml.cs, the code would look like this:
SimpleWebToken swt = (SimpleWebToken)SimpleWebTokenHandler.GetTokenFromString( _rstrStore.SecurityToken );
You should then find the IdentityProvider (sign in type) and NameIdentifier (user ID) claims that ACS issued inside the swt.Parameters.
If you want to host your own custom sign in page in this scenario, ACS provides functionality for that as well:
http://msdn.microsoft.com/en-us/library/gg185963.aspx
You could also look at the hands on labs from the identity framework.

Resources