来自 Youtube API 的 OAUTH 凭据无效 [英] Invalid Credentials for OAUTH from Youtube API

查看:21
本文介绍了来自 Youtube API 的 OAUTH 凭据无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在 OAuth 2.0 Playground 中使用 Youtube API 时出现 401 Invalid Credentials 错误.

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

回复是:

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

步骤可以复制这里.

  1. 选择管理 Youtube 帐户 API
  2. 授权
  3. 获取访问令牌
  4. 尝试调用任何 Youtube API(您可能还需要插入自己的 API 密钥)

访问令牌是有效的(非 Youtube API 调用工作正常),我已经尝试了许多不同的帐户,这些帐户设置了 Youtube 帐户和频道(所以回复 这里不是正在发生的事情).

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).

API 在 立即试用 这里的部分,所以这很奇怪.

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?

推荐答案

您必须在 OAuth Playground 的设置中选择使用您自己的 OAuth 凭据"选项(链接在右上角角).

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

您还需要将以下 URL 添加到 开发者控制台<中您项目的重定向 URI 列表中/a>:

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

如果这样做,则无需传递 API 密钥.

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

这篇关于来自 Youtube API 的 OAUTH 凭据无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆