通过访问令牌访问YouTube频道标题需要什么作用域?
我正在做一个使用谷歌PHP API库的项目。我目前正在使用通过访问令牌访问YouTube频道标题需要什么作用域?,youtube,google-api,youtube-api,Youtube,Google Api,Youtube Api,我正在做一个使用谷歌PHP API库的项目。我目前正在使用离线访问的作用域: https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.upload 但这并没有给我访问权来获取经过身份验证的频道的频道标题 然后我尝试添加更多作用域: https://www.googleapis.com/auth/youtube.readonly https://www.googleap
离线访问的作用域:
https://www.googleapis.com/auth/youtube.force-ssl
https://www.googleapis.com/auth/youtube.upload
但这并没有给我访问权来获取经过身份验证的频道的频道标题
然后我尝试添加更多作用域:
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/youtubepartner
https://www.googleapis.com/auth/youtubepartner-channel-audit
但我也得到了同样的结果。有没有一个与YouTube无关的范围是我所缺少的
-
这是我正在使用的代码,请注意,$this->client
是Google\u client
的一个实例:
/**
* Fetch channel title
*
* @return string
*/
public function fetchChannelTitle() {
/** @var \Google_Service_YouTube_Channel $details */
$details = $this->getChannelDetails();
$snippet = $details->getSnippet();
return $snippet->getTitle();
}
/**
* Get channel details
*
* @throws YouTubeException
*/
public function getChannelDetails()
{
if (!$this->access_token) {
throw new YouTubeException('NO_REFRESH_TOKEN');
}
$this->client->setAccessToken($this->access_token);
$parts = 'snippet,contentDetails,statistics';
$params = ['mine' => true];
$response = (new Google_Service_YouTube($this->client))->channels->listChannels(
$parts,
$params
);
return $response->getItems()[0];
}
别忘了包括这个
以及snippet
下的字段参数“title
”
这是我使用的:
别忘了包括这个
以及snippet
下的字段参数“title
”
这是我使用的:
我认为forcessl作用域与justyoutube作用域相同。我将研究这两个作用域。我认为强制SSL作用域与YouTube作用域相同。我将研究这两个范围
https://www.googleapis.com/auth/youtube
"title": "Steve Jobs" //that's my title