Invalid Credentials for OAUTH from Youtube API

…衆ロ難τιáo~ 提交于 2019-12-22 05:53:28

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/22679147/invalid-credentials-for-oauth-from-youtube-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!