【问题标题】:Deleting a YouTube favorite when authenticated with OAuth2使用 OAuth2 进行身份验证时删除 YouTube 收藏夹
【发布时间】:2015-08-24 16:33:21
【问题描述】:

我正在尝试使用 YouTube API 删除收藏夹。由于 Google 最近弃用了 AuthSub 认证方式,所以我决定选择官方推荐的 OAuth2 认证方式。

我可以将视频设置为收藏,但是当我尝试使用the described method in the docs 删除它时,响应是:

Only the favorite owner can remove it.

我使用的是Google OAuth2 Playground,并且我可以将视频设置为收藏,因此我非常确定身份验证没有错误,但仍然无法正常工作。

我提出的要求如下:

DELETE /feeds/api/users/default/favorites/nq3gs6PG8-E HTTP/1.1
Host: gdata.youtube.com
X-gdata-key: key=DEVELOPER_KEY
Content-length: 0
Authorization: OAuth ACCESS_TOKEN
----------------------------------------
HTTP/1.1 403 Forbidden
Content-length: 38
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
X-google-cache-control: remote-fetch
-content-encoding: gzip
Server: GSE
Reason: Forbidden
Via: HTTP/1.1 GWA
X-gdata-user-country: US
Cache-control: private, max-age=0
Date: Thu, 20 Sep 2012 17:53:19 GMT
X-frame-options: SAMEORIGIN
Content-type: text/html; charset=UTF-8
Expires: Thu, 20 Sep 2012 17:53:19 GMT

Only the favorite owner can remove it.

我确实已将“nq3gs6PG8-E”视频设为收藏,我的 DEVELOPER_KEY 和 ACCESS_TOKEN 是正确的。

我想知道是否有修复,或者我缺少什么?我不想回滚已弃用的身份验证方法,那不安全,但我有什么选择吗?

【问题讨论】:

    标签: youtube oauth-2.0 gdata favorite


    【解决方案1】:

    请看https://developers.google.com/youtube/2.0/developers_guide_protocol_favorites#Deleting_a_favorite_video

    具体来说,这个注释:

    您用于删除收藏视频的 ID 不是 对于该视频,但具有唯一关联的不同值 与将其标记为收藏的用户的视频。删除收藏夹 视频,请始终将 DELETE 请求发送到 最喜欢的视频供稿为视频指定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-29
      • 2013-06-24
      • 2019-11-26
      • 1970-01-01
      相关资源
      最近更新 更多