1

这是我的客户端设置

$this->_client = new Google_Client();
$this->_client->setClientId( $_config['OAUTH2_CLIENT_ID'] );
$this->_client->setClientSecret( $_config['OAUTH2_CLIENT_SECRET'] );
$this->_client->setScopes( array( 'https://www.googleapis.com/auth/youtube', 'https://www.googleapis.com/auth/yt-analytics.readonly' ) );
$this->_client->setAccessType( 'offline' );
$this->_client->setRedirectUri( filter_var( $_config['OAUTH2_REDIRECT_URI'] ),  FILTER_SANITIZE_URL );


$this->_analytics = new YoutubeAnalyticsClient( $this, $this->_client );

我为每个登录系统的用户做这个

$this->_analytics->setChannelId( $_usr_yt_channel_id );
$this->_analytics->setStartDate( $_period[0] );
$this->_analytics->setEndDate( $_period[1] );

我只有第一次登录的用户才收到这样的回复

2014-06-27 12:39:48 Exception: Error calling GET https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DUCoZb0E-9pd6O7BPhd-tU2NA&start-date=2014-06-15&end-date=2014-06-25&metrics=views&dimensions=country&filters=video%3D%3DftqqLcm5U1U&sort=-views&quotaUser=UCoZb0E-9pd6O7BPhd-tU2NA: (403) Forbidden
2014-06-27 12:39:51 Exception: Error calling GET https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DUCoZb0E-9pd6O7BPhd-tU2NA&start-date=2014-06-15&end-date=2014-06-25&metrics=viewerPercentage&dimensions=ageGroup&filters=video%3D%3DftqqLcm5U1U&sort=ageGroup&quotaUser=UCoZb0E-9pd6O7BPhd-tU2NA: (403) Forbidden

删除“quotaUser”不会改变任何东西。

4

0 回答 0