【发布时间】:2015-07-10 19:47:40
【问题描述】:
我正在尝试检索用户视频的评论线程,但收到 403 Insufficient Permission 错误。
我在开发者控制台中的 oAuth 客户端启用了 Youtube Data v3 API,并且我在生成令牌时设置了 youtube 范围。
这是我用来在 oauth 流程中授权应用程序的客户端。我已经尝试了 youtube 范围和 youtube.readonly 范围,并且都没有公开 commenThreads。
$client = new Google_Client();
$client->setClientId($auth_config['client_id']);
$client->setClientSecret($auth_config['client_secret']);
$client->setRedirectUri($auth_config['redirect_uri']));
$client->addScope(Google_Service_YouTube::YOUTUBE);
$client->setAccessType('offline');
在我的应用程序的其他地方,我使用如下令牌。
$client = new Google_Client();
$client->setAccessToken($access_token);
$youtube = new Google_Service_YouTube($client);
$comments = $youtube->commentThreads->listCommentThreads('snippet', [ 'videoId' => $videoId]);
我可以查看用户的视频,据我所知,我也应该有权查看 cmets。我错过了什么?我的代码几乎与 PHP 客户端库示例相同。
【问题讨论】:
标签: php api youtube-api authorization