【问题标题】:PHP google API Service Account used for getting Acces Token for Youtube API 2.0 upload video用于获取 Youtube API 2.0 上传视频的访问令牌的 PHP google API 服务帐户
【发布时间】:2012-11-25 12:56:30
【问题描述】:

我的主要问题是:我可以使用从服务帐户获得的访问令牌将视频上传到 youtube 吗?

帐户是新的,已连接到 youtube,频道已创建并在以下模式下获得访问令牌:

$client = new Google_Client();
$client->setApplicationName('Youtube Login');

$key = file_get_contents($key_file);

$client->setClientId($client_id);
$client->setAssertionCredentials(new Google_AssertionCredentials(
   $service_account_name,
   array(
      'https://www.googleapis.com/auth/youtube.upload',
      'https://www.googleapis.com/auth/youtube'
      'https://gdata.youtube.com/action/GetUploadToken',
      'https://gdata.youtube.com'
   ),
   $key)
);

$client::$auth->refreshTokenWithAssertion();
$json = $client->getAccessToken();
$accessToken = json_decode($json)->access_token;

所以访问令牌没问题。现在,当我创建标头并插入访问令牌和开发人员密钥以及此处描述的所有内容时:https://developers.google.com/youtube/2.0/developers_guide_protocol_browser_based_uploading 我收到 NoLinkedYouTubeAccount 错误。

如果不能使用服务帐户以这种方式上传视频,有没有办法在视频上传中跳过用户交互?

我们有帐户,但我们不希望用户被重定向到任何地方,因为 ClientLogin 已被弃用并且 Youtube API v2.0 不支持 OAuth2 服务帐户访问令牌。

有办法吗?搜索了整个网络,看到了类似的未解决问题,但一无所获。

【问题讨论】:

    标签: php video upload youtube


    【解决方案1】:

    您不能使用服务帐号来完成此操作: https://code.google.com/p/google-api-php-client/wiki/OAuth2?hl=de-DE#Service_Accounts 我也在寻找一种无需最终用户身份验证即可执行 youtube api 调用的方法。 How do you recieve an access token without user intervention for a known account using Google Youtube API v3?

    【讨论】:

      猜你喜欢
      • 2015-02-11
      • 2019-01-11
      • 1970-01-01
      • 2021-12-02
      • 2019-01-05
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      相关资源
      最近更新 更多