Youtube API v3 错误:403 (playlistItemsNotAccessible) [英] Youtube API v3 Error: 403 (playlistItemsNotAccessible)

查看:95
本文介绍了Youtube API v3 错误:403 (playlistItemsNotAccessible)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在 stackoverflow 上的第一篇文章 - 如果我应该重新表述问题和/或提供有关该问题的更多详细信息,请告诉我.

使用

步骤 2 向下滚动并点击 SAVE AND CONTINUE

第 3 步点击添加或删除范围

第 4 步选择这些范围

步骤 5 向下滚动并点击 UPDATE

第 6 步现在您将看到这些添加的范围

步骤 7 向下滚动并点击 SAVE AND CONTINUE

并且不要忘记在代码中添加作用域.

这是一个 Android 代码示例.

private static final String[] SCOPES = {YouTubeScopes.YOUTUBE_READONLY, YouTubeScopes.YOUTUBE_FORCE_SSL, YouTubeScopes.YOUTUBE, YouTubeScopes.YOUTUBEPARTNER};

This is my first post at stackoverflow - please let me know if I should rephrase the question and/or provide more details regarding the issue.

Using the javascript examples provided on https://developers.google.com/youtube/v3/code_samples/javascript#create_a_playlist we have successfully been able to create youtube playlists and also update them with new videos. However, trying to add videos to a playlist created by another user generates the following error.

{
 "error": {
  "errors": [
   {
    "domain": "youtube.playlistItem",
    "reason": "playlistItemsNotAccessible",
    "message": "Forbidden"
   }
  ],
  "code": 403,
  "message": "Forbidden"
 }
}

In Youtube we have granted permissions for the other user to add videos in the particular playlist and that user has clicked the "contribution acception link".

(If Youtube Direct Lite wouldn't throw API v2-errors when trying to view pending additions, we would have been using that app.)

解决方案

You need to add these scopes for your projects in Google Cloud Platform.

  1. https://www.googleapis.com/auth/youtubepartner
  2. https://www.googleapis.com/auth/youtube
  3. https://www.googleapis.com/auth/youtube.force-ssl

Link to your project

https://console.cloud.google.com/apis/credentials/consent/edit?project=HERE_IS_YOUR_PROJECT_ID

Step 1 Click to EDIT APP

Step 2 Scroll down and click SAVE AND CONTINUE

Step 3 Click to ADD OR REMOVE SCOPES

Step 4 Select these scopes

Step 5 Scroll down and click UPDATE

Step 6 Now You will see these added scopes

Step 7 Scroll down and click SAVE AND CONTINUE

And do not forget to add scopes in your code.

Here is an Android code example.

private static final String[] SCOPES = {YouTubeScopes.YOUTUBE_READONLY, YouTubeScopes.YOUTUBE_FORCE_SSL, YouTubeScopes.YOUTUBE, YouTubeScopes.YOUTUBEPARTNER};

这篇关于Youtube API v3 错误:403 (playlistItemsNotAccessible)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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