为YouTube数据API获取403禁止的错误 [英] Getting a 403 Forbidden Error for Youtube Data API

查看:832
本文介绍了为YouTube数据API获取403禁止的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对YouTube数据API进行API调用时,我收到403禁止错误.

I am getting a 403 forbidden error when making an API call to the YouTube Data API.

我尝试生成不同类型的密钥(Web浏览器,服务器等).密钥不受限制.我尝试从服务器和Chrome的邮递员拨打电话.请求网址和响应如下.

I have tried to generate different types of keys (Web Browser, Server, etc.). The key is unrestricted. I have tried making the call from a server and from postman for Chrome. The request URL and response is below.

https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=surfing&key={api-key}

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "forbidden",
                "message": "Forbidden"
            }
        ],
        "code": 403,
        "message": "Forbidden"
    }
}

以下是标题:

alt-svc →quic=":443"; ma=2592000; v="43,42,41,39,35"
cache-control →private, max-age=0
content-encoding →gzip
content-length →118
content-type →application/json; charset=UTF-8
date →Tue, 10 Jul 2018 15:00:27 GMT
expires →Tue, 10 Jul 2018 15:00:27 GMT
server →GSE
status →403
vary →Origin, X-Origin
x-content-type-options →nosniff
x-frame-options →SAMEORIGIN
x-xss-protection →1; mode=block

推荐答案

此错误是

This error is a Core API error as what specified in the Youtube API documentation.

禁止访问.该请求可能未得到适当的授权.

Access forbidden. The request may not be properly authorized.

您可以查看文档.您将逐步了解如何正确获取用户授权.

You can check the step by step guide provided in the documentation. You will bump with the step on how to properly acquire user authorization.

适用于希望编写交互应用程序的开发人员 YouTube.它说明了YouTube和API的基本概念 本身.它还概述了不同的功能 API支持.

Intended for developers who want to write applications that interact with YouTube. It explains basic concepts of YouTube and of the API itself. It also provides an overview of the different functions that the API supports.

这篇关于为YouTube数据API获取403禁止的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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