Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Credentials for OAUTH from Youtube API

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?

like image 472
chris.d Avatar asked Oct 01 '22 05:10

chris.d


1 Answers

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.

like image 184
Vinicius Pinto Avatar answered Oct 12 '22 01:10

Vinicius Pinto