63

I am trying to use the Youtube API to pull in all the videos from a particular channel. I set up the project in Google Developers Console and got an API browser key. I enabled YouTube Data API v3 and for safe measure, I enabled YouTube Analytics API.

I do not know what I am getting this error. Can anyone help me.

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
   }
  ],
  "code": 403,
  "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
 }
}

Code i'm using. It doesn't do anything yet, just try to fetch the data.

jQuery.getJSON('https://www.googleapis.com/youtube/v3/channels?part=UncleBens&id=UncleBens&key=AIzaSyDXD80S1mFHH2HSZFxLemkae-_Cl_nY5Xk', function(data){
    console.log(data);
    for(var i=0; i<data.data.items.length; i++) {
       console.log(data.data.items[i].title); // title
       console.log(data.data.items[i].description); // description
    }
});
DFord
  • 2,352
  • 4
  • 33
  • 51

14 Answers14

149

You must enable a couple of API (in new google console) for things to work as expected.

Go to https://console.developers.google.com and make sure under "APIs" that you have following APIs enabled:

  1. "Contacts API"
  2. "Google+ API"
Omer Aslam
  • 4,534
  • 6
  • 25
  • 24
  • 1
    I had trouble using Google Play Services for the function hide for the Web platform. I kept getting this 403 error. Enabling those 2 APIs and having "Google Play Game Services" and "Google Play Game Management" enabled seemed to solve my problem. – cavpollo Jun 16 '14 at 04:42
  • 5
    This also worked for plain OAuth2 authentication i.e. just using Google Accounts for login, rather than accessing any additional services. – notreadbyhumans Jul 26 '14 at 09:57
  • This worked to me, but doesn't make any sense, since i was trying to get "videos uploads" from a peculiar channel. – Nando Aug 08 '14 at 16:29
  • 2
    This is the correct answer if you have an error in web and not server application type. @Gsx's answer is for server one – Ivan Linko Sep 19 '14 at 13:51
  • thank you! can I ask for a link on how you know that? must be in their docs somewhere.... – jmadsen Nov 20 '14 at 00:34
  • 2
    oh man, i was trying to solve this for 5 hours dude. i had tried everything. i'd buy you a juice if you were here dude. – The Onin Apr 27 '15 at 04:11
  • this is crazy!! i didnt see this mentioned anywhere obvious. thanks, saved me! – Micha Schwab Aug 10 '15 at 20:55
  • Google should keep their error messages up to date. – aegyed Nov 13 '15 at 15:39
  • The key is to enable "Contacts API" as well, which, unlike "Google+ API", is not mentioned in error messages. Thanks man! – vucalur Feb 01 '16 at 07:42
  • This is the correct answer! Please, make this as correct! – Adriano Tadao Feb 02 '17 at 01:49
  • i was trying google login authentication, var request = gapi.client.plus.people.get({ 'userId': 'me' }); was getting executed ...but after enabling it worked – nick Jun 21 '17 at 06:19
52

Try setting the "Referers" to "Any referer allowed" for your project (just leave the field empty) in the Google Developers Console if it is not already like that.

To do this, go to your Google Developers Console and open API & Auth / Credentials and click "Edit allowed referers" empty the input field.

Janyk
  • 571
  • 3
  • 18
Gsx
  • 942
  • 8
  • 14
  • 9
    That worked, but I don't understand why. Can you explain why that worked? Is it because the call was coming from the user, not the server that has the domain name? – DFord Apr 04 '14 at 20:42
  • 2
    I think it works as a whitelist, anything not on it is blocked. Also I would create a new key and delete this one since other people could use up your quota. – Gsx Apr 05 '14 at 12:51
  • 1
    It worked for me. But we have to remember to keep our API key private. – Francisco Ochoa Jan 08 '15 at 19:24
  • The solution bellow (@Reality) is what helped me. I actually didn't need to create any `Public API access` keys or change the `referrers` option. All I need to do is enable the APIs. – echo Jun 23 '15 at 18:20
  • 4
    I can't find this option "Edit allowed referrers". It is about an hour trying to find this link, or any thing may be relevant, but in vain. – Dr. MAF Aug 26 '15 at 16:08
  • 5
    This one is NOT the correct answer. The problem is that API is just not enabled in the console. The answer by Omer Aslam is the correct one. – igorpavlov Oct 17 '15 at 12:43
14

I faced the same issue. While I am not sure of the reason and logic behind this, but the following steps worked -

1) I left the referers field blank (Any referer allowed). However, this alone did not work. 2) I regenerated the browser key. That did the trick.

Hope this helps.

Shrisha Kumar
  • 141
  • 1
  • 2
8

I've faced the same problem just this morning, but I was just trying to login with a google account. I was getting the same exact message.

What worked to me was to put ON this two APIs: Google+ API Contacts API

in your console: https://console.developers.google.com/project/your-project-id/apiui/api

I do not want to empty the "allowed referers field" as I prefer to have under control from where people can login to my app. I didn't have to change my API Key neither. Just for the records, I am using Spring Social Google 1.1.0

Oscar Quoners
  • 93
  • 1
  • 3
  • Thank you! This one is the one that saved me! :) I am using Analytics Dashboard Plugin for Wordpress and the changes you suggested got the plugin working :) – Alfie Robles Mar 06 '15 at 16:36
4

I had the same problem. I tried emptying the referral list, but that did not fix the problem. Then I regenerated the key. The new key gave an "expired key" error. So I reverted to the obsolete key, which now worked.

LFC
  • 86
  • 2
4

I encountered the same issue when I was using the Management API of Google Analytics. Here's what worked for me:

  1. Make sure the following APIs are enabled in your API console:

    • YouTube Data API v3
    • YouTube Analytics API
    • Contacts API
    • Google+ API
  2. Make sure the the scopes required by the API properly defined in your application. For Youtube, use scopes required to access API calls yuo

  3. Make sure the CLIENT_ID and CLIENT_SECRET of the Google Project in your API console are the correct ones defined in your client application.

Karlo
  • 51
  • 1
3

Make sure that the 'Youtube Data API V3' is enabled for your project. You can find it under 'APIs & Auth' -> 'APIs'.
Also, after enabling the Youtube Data APIs for your project, wait for a minute before firing requests using the API key.

Sumanth
  • 61
  • 6
2

in api's and auth credentials in https://console.developers.google.com just leave the key for server applications Edit allowed ips empty this will work

Manoj Rammoorthy
  • 1,384
  • 16
  • 16
2

If you use Public API access for action, you must to add your server ip to Allowed IPs list (Select Project -> APIs and Auth -> Credentials). If not, you will get an error as above: "Access Not Configured. Please use Google Developers Console to activate the API for your project."

Please view my attached file to view more enter image description here

dakiquang
  • 684
  • 1
  • 8
  • 24
1

You must enable a couple API's for things to work as expected.

First go to https://console.developers.google.com and make sure under "APIs" that you have the Contacts API and Google+ API enabled.

Once that is done you should no longer see that error message.

More can be found-

  1. https://github.com/zquestz/omniauth-google-oauth2/issues/111
  2. https://www.joomlapolis.com/forum/6-news-and-publicity/229505-configuring-cb-connect-7x#263260
Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161
0

I ran into this same issue and what worked for me was using a "Server Key" instead of a "Browser Key". Not sure why that would matter since I was making the request from a browser in both cases, but it works :)

dustinrwh
  • 888
  • 1
  • 14
  • 16
0

Setting "Referers" to "Any referer allowed" for your project (just leave the field blank)

to goes your console (https://console.developers.google.com/project) and open Api & auth >> Credentials and click under the "Edit allowed referers" empty the input field. hard refresh the query

work Fine.

Gopal Rathod
  • 150
  • 7
0

I faced the same issue and my problem was because I had different names in my project and Google APIs

This is an example with Android

    public MakeRequestTask(GoogleAccountCredential credential) {
            HttpTransport transport = AndroidHttp.newCompatibleTransport();
            JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
            mService = new com.google.api.services.calendar.Calendar.Builder(
                    transport, jsonFactory, credential)
                    .setApplicationName("Google Calendar API Example")
                    .build();
        }

Here the name is "Google Calendar API Example"

enter image description here

and the name in Google APIs is "App Example"

To resolve the problem I changed the name in my project to

        public MakeRequestTask(GoogleAccountCredential credential) {
            HttpTransport transport = AndroidHttp.newCompatibleTransport();
            JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
            mService = new com.google.api.services.calendar.Calendar.Builder(
                    transport, jsonFactory, credential)
                    .setApplicationName("App Example")
                    .build();
        }
Jorge Casariego
  • 21,948
  • 6
  • 90
  • 97
0

Ok this is old but I figured this out for my case and I thought it might help others. I went to oauth and it seemed to resolve.

the real issue is that if you use an unrestricted key [and maybe, depepending on the api enabled] have a billing account linked; the api should work. If it works unrestricted, you are on the right track.

Once you restrict it to android it will fail again with that key until you sign your app. The easiest way i found was the use a signing config for the variants under android in the gradle file.

signingConfigs {
    debug {
        storeFile file("/users/xxxxxxxxxx/Android/keystores/google_demos/debugandroid.jks")
        storePassword "xxxxxxxxxx"
        keyAlias "com.example.xxxxxxxxxx"
        keyPassword "xxxxxxxx"
    }
}