服务ForbiddenException链接频道

时间:2013-07-03 00:37:26

标签: youtube-api

我有一个为客户创建和上传视频的应用程序。在尝试上载之前,客户授予授权,并保存生成的访问权限和刷新令牌。有时,客户没有与其Google帐户关联的YouTube频道。我检测到这个并为它们创建一个通道。这通常很好。但不总是。以下是创建频道失败的示例:

Obtaining access token for Customer
post https://accounts.google.com/o/oauth2/token
HTTP Response: 200
{
 "access_token" : "_new_access_token_",
 "token_type" : "Bearer",
 "expires_in" : 3600
}

Uploading video '_video_name_' for Customer
post http://uploads.gdata.youtube.com/feeds/api/users/default/uploads
    Authorization: Bearer _new_access_token_
    GData-Version: 2.1
    X-GData-Key: key=_GData_Key_
    Slug: n3n1xs.mp4
    Content-Type: multipart/related; boundary="51d366cb05b71"
    Content-Length: 255958407
    Connection: close
HTTP Response: 403
<?xml version='1.0' encoding='UTF-8'?><errors><error><domain>yt:service</domain><code>youtube_signup_required</code></error></errors>

Obtaining channel names for Customer
get https://gdata.youtube.com/feeds/api/suggest/username?hint=CustomerNameVT&fields=entry%2Ftitle
    GData-Version: 2.1
    X-GData-Key: key=_GData_Key_
HTTP Response: 200
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom'><entry><title>CustomerNameVT</title></entry><entry><title>VTCustomerName</title></entry><entry><title>VTNameCustomer</title></entry><entry><title>CustomerVTName</title></entry><entry><title>CustomerNameVT1</title></entry><entry><title>NameCustomerVT</title></entry><entry><title>NameVTCustomer</title></entry></feed>

Linking YT channel for Customer (CustomerNameVT)
put https://gdata.youtube.com/feeds/api/users/default
    Authorization: Bearer _new_access_token_
    Content-Type: application/atom+xml
    GData-Version: 2.1
    X-GData-Key: key=_GData_Key_
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:yt='http://gdata.youtube.com/schemas/2007'><yt:username>CustomerNameVT</yt:username></entry>
HTTP Response: 403
<errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>ServiceForbiddenException</code><internalReason>Forbidden</internalReason></error></errors>

请注意,请求的名称是建议用户名api建议的第一个名称。据我所知,这应该有效。它通常会。这次出了什么问题?

1 个答案:

答案 0 :(得分:0)

将Google帐户关联到新渠道的API为deprecated

我们的current recommendation是明确地让用户完成基于网络的链接过程,从https://youtube.com/create_channel开始(或相当于m.youtube.com)。

相关问题