5

I am getting 401 Invalid Credentials error trying to use the Youtube API in the OAuth 2.0 Playground.

Response is:

{
  "error": {
    "code": 401, 
    "message": "Invalid Credentials", 
    "errors": [
      {
        "locationType": "header", 
        "domain": "global", 
        "message": "Invalid Credentials", 
        "reason": "authError", 
        "location": "Authorization"
      }
    ]
  }
}

Steps can be reproduced here.

  1. Select Manage Youtube account API
  2. Authorize
  3. Get access token
  4. Attempt to call any Youtube API (you may need to plug your own API key in as well)

The access token is valid (non-Youtube API calls work fine) and I have tried this with a number of different accounts which have Youtube accounts and channels set up (so the reply here is not what's happening).

The API works fine in the Try it Now section here so this is quite strange.

Maybe somebody can try these steps with their account and verify if the outcome is the same or not?

2
  • I got a 403 "Access Not Configured. Please use Google Developers Console to activate the API for your project." which doesn't seem to make sense, since the project is owned by Google Commented Mar 27, 2014 at 17:43
  • For some reason it is expecting an API key as well - even though the access token should be enough. If you have an API key though, add that in as a parameter and see what the result is then. Commented Mar 27, 2014 at 20:52

1 Answer 1

4

You have to choose the "Use your own OAuth credentials" option in the settings of the OAuth Playground (link at the top right corner).

You also need to add the following URL to the list of Redirect URIs of you project in the Developers Console:

https://developers.google.com/oauthplayground

If you do that, you don't need to pass the API key.

Sign up to request clarification or add additional context in comments.

6 Comments

Ultimately it's for an Android application not a web app - I was using the Playground to try to show the problem I'm having, apologies if it has extra requirements that I wasn't familiar with. Just doing a GET call and passing the access token should be all that is required though, should it not?
This does not help. I am still not sure why I am able to use the OAuth access token in the Playground to call e.g. Google Plus API's but not the Youtube ones. What am I missing?
FYI I am using documentation here. Code in that document is just a GET call with the access token as a param in the URL -> how is that any different to what the Playground is doing? And we know that it's not an issue with the access token (because it works for other APIs and the scope is correct) so I can't see what the problem can be, or why I would need to go down the creating a client ID route.
I'm not sure what's going on with the Playground, if I don't specify my own OAuth credentials, I only get a 403 error for the YouTube API. But are you having the same problem in your app? If you get a valid access token, you should be able to access the API just passing it in the URL.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.