【发布时间】:2015-11-19 10:07:36
【问题描述】:
我正在尝试使用 PHP API (V3) 将视频上传到 youtube。
我的问题: 我不想对特定用户进行身份验证,但让我的应用程序使用服务器密钥(而不是客户端 ID)并上传给拥有该应用程序的用户。
我的代码:
$DEVELOPER_KEY = '';
$APPNAME = "";
$client = new Google_Client();
$client->setDeveloperKey($DEVELOPER_KEY);
$client->setScopes('https://www.googleapis.com/auth/youtube');
$client->setApplicationName($APPNAME);
$videoPath = "";
$video = new Google_Service_YouTube_Video();
$youtube = new Google_Service_YouTube($client);
$insertRequest = $youtube->videos->insert("status,snippet", $video);
// Create a MediaFileUpload object for resumable uploads.
$media = new Google_Http_MediaFileUpload(
$client, $insertRequest, 'video/*', null, true, 1 * 1024 * 1024
);
错误:
需要用户登录
我不想使用客户端身份验证...没有涉及特定用户。 有没有办法仅验证服务器密钥(代表应用所有者)?
【问题讨论】:
标签: php api authentication oauth-2.0 youtube-api