How to make Youtube Data Search API open for public usage? - javascript

Currently, I can use Youtube Data API to search for videos. However, I must be logged in onto my google account. Is it possible to conduct searches without logging in into an arbitrary google account? This way any user can just search without logging in.
I am using Youtube api in javascript

Search is a special case, where users don't have to log in through OAuth2. But you will need to provide your API key to authorize the access uf API usage.
Here's the example. HTML and JS

You'll need an API key so that any searching done through your app can be properly analyzed, routed, etc. If you're using v3 of the data API (which you should now that it's in production), you can easily request a key as you would get access to any google API:
Visit https://code.google.com/apis/console and register your
project (don't forget to give it a project ID)
From that project dashboard, select the Youtube API under the
'Services' tab.
Since you just want to do searching, under the 'API
Access' tab you can create a browser app key (part of the 'Simple
API Access' section). That generated key should be appended to all
REST calls.
If you still need to use v2 of the API for some reason, you can create your key here:
https://code.google.com/apis/youtube/dashboard/gwt/index.html

Related

How to list accessible customer list in Google Ads API?

We are using Google ads API and we are getting the refresh_token and access_token from the oauthLibrary.
Now due to some reason (Majorly cause we are using JavaScript and there's no library for JavaScript officially from Google) we are relying on the REST API.
I want to fetch a list of Accounts attached to the the given access token. (no matter manager or not Manager) I just need the list.
I have tried the following endpoint
https://googleads.googleapis.com/v1/customers:listAccessibleCustomers
But I am getting 404 Not found in that, So I think it is discontinued, Any idea how I can fetch the list through REST_API.
I think that you just need to change the v1 for v9. The official documentation about the API has a similar sample:
https://googleads.googleapis.com/v9/customers:listAccessibleCustomers

How to allow users to access my Google API application without authenticating for it?

I've developed a small webapp, that pulls raw data from a Google Spreadsheet and builds it on a html, so my website users can see, filter and navigate through the data.
For that, I'm using Google Sheets API v4, but even going to an HTML, users are asked to "AUTHORIZE" access using their Google Accounts, before seeing the table/data.
Is there a way to display this table/data on the HTML, without requesting users to authorize through OAuth?
If you're dealing with accessing data and performing Google API calls, authorization is Google's way to protect and secure the user's data.
If you want to display the data without needing to undergo authorization, publish it to the web:
File -> Publish to the web. An embed code which contains a public url will be provided for you.
Here's a sample of my public data:
https://docs.google.com/spreadsheets/d/1mvFPT2Xx8bNEMUdPC9TDOexzNqVS399bxQATV3JVOyg/pubhtml?widget=true&amp

Google Map API key error "Your site URL to be authorized"

I have searched many links and read documents related to google api key, but every time I am getting the only error of Your site URL to be authorized
I am creating a PhoneGap hybrid application where I am not sure if which URL I have to pass to google api key referrer so I am stuck here
What I am using for google script is:
<script src="https://maps.googleapis.com/maps/api/js?v=3&key=MY_API_KEY&sensor=false" type="text/javascript"></script>
Updated
I have already created Browse Key using google console but now What I have to pass in referrer link ( ? ) while I am creating a cordova application
I Dont know if this will help anyone but I spent a good hour trying to figure out this problem and ended up realizing I had the wrong API enabled.
You need Google Maps JavaScript API enabled.Also sometimes you need to specify https.
1.Leave it blank
2.You need to enable the google maps api for your project.
You need to enable the google maps api for your project.
if your API key have no limitation and it still not work - trying to add signed_in=true to url. It helps for me.
This error means that the current URL loading the Maps JavaScript API has not been added to the list of allowed referrers. Please check the referrer settings of your API key in the Cloud Console. (source: https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error)
Go to the Google Cloud credentials page to add your website url: https://console.cloud.google.com/projectselector2/google/maps-apis/credentials
Select the API key that you want to set a restriction on. The API
key property page appears.
Under Key restrictions, set the following restrictions:
Application restrictions:
To accept requests from the list of website that you supply, select HTTP referrers (web sites) from the list of Application restrictions.
Specify one or more referrer web sites. For example, *.google.com accepts all sites ending in google.com, such as https://developers.google.com.
Note: file:// referers need a special representation to be added to the key restriction. The file:// part should be replaced with __file_url__ before being added to the key restriction. For example, file:///path/to/ should be formatted as __file_url__//path/to/*. After enabling file:// referers, it is recommended you regularly check your usage, to make sure it matches your expectations.
Save your changes
You must include an API key with every Maps JavaScript API request. In the following example, replace YOUR_API_KEY with your API key.
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"></script>
(source: https://developers.google.com/maps/documentation/javascript/get-api-key#restrict_key)

What API Key is Google using when I load the JS script

I am loading the google maps/places JS API in my web app like this in my web/Ionic mobile app.
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places,geometry"></script>
I am not providing an API key in that URL. What api key is google using? If different users use the web-app, will it use a seperate API key for each user? and therefore each user will have a limit on the requests as opposed to the entire app having the limit?
This is the angular directive using the API. It doesn't have a key defined in it.
https://github.com/kuhnza/angular-google-places-autocomplete
Thanks
What api key is google using? If different users use the web-app, will it use a seperate API key for each user?
No, Google API is not requires key. But key gives very useful information (read the link below). Key is unique for each app you use (if you register it in console). More detailed information can be found at Google Developer Console and at page: https://developers.google.com/maps/documentation/javascript/get-api-key
And therefore each user will have a limit on the requests as opposed to the entire app having the limit?
About limits in Maps Google wrote here:
https://developers.google.com/maps/documentation/javascript/usage

Write to a Google spreadsheet from JavaScript using the Public API access (no OAuth)

I'd like to allow a user to visit one of my sites, enter some information into a field, and then save that information into a Google Spreadsheet via JavaScript.
I don't want the user to login via Google or have to do any special authentication.
It's Ok if the spreadsheet needs to be open to public; the data's not sensitive.
I don't want to use a Google Form, I want to have full control over the client-side UI.
I've been reading through the Google developer docs, but they only make mention to an OAuth login solution. The Google Developer Console allows you to create a "Public API access key", but does not explain how it's used.
All of the examples are for the scenario where the user is using your app to access his own files. In your case, you want the app to access your own file. This isn't easy. The only ways I can see are :-
Use a server app (appengine works well) to do the access
Very carefully set up permissions and store a refresh token in your app.
Option 2 could be your worst security nightmare if you don't do it carefully, and even then may be an infringement of Google T's and C's since it's akin to distributing your password.
Once you figure out the auth, you'll need to check out the spreadsheet API (https://developers.google.com/google-apps/spreadsheets/), as this is the API that allows you to update an existing spreadsheet. The Drive API can only upload an entire new spreadsheet.

Categories