I have a youtube channel and I use Youtube API v3 to pull out a list of videos uploaded to this channel (using php libraries ). The following is a snippet of the code I'm using:
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_YouTubeService.php';
session_start();
$OAUTH2_CLIENT_ID = 'xxxxxxxxx';
$OAUTH2_CLIENT_SECRET = 'xxxxxxxxx';
$client = new Google_Client();
$client->setClientId($OAUTH2_CLIENT_ID);
$client->setClientSecret($OAUTH2_CLIENT_SECRET);
$redirect = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'], FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);
$youtube = new Google_YoutubeService($client);
$channelsResponse = $youtube->channels->listChannels('contentDetails', array(
'mine' => 'true',
However, I get an annoying pop-up that asks me to log in and authenticate to get the details. How can I get rid of this popup? I plan to write a cron task that will periodically iterate over the video list and save it in the database, so I do not want this authentication pop-up window.
NOTE. When I try to pull a video from a playlist, I do not ask for authentication and api functions smoothly
$playlistItemsResponse = $youtube->playlistItems->listPlaylistItems('snippet,status', array(
'part' => 'snippet,contentDetails',
'maxResults' => 50,
'playlistId' => 'UUGpAMVStIfaQ32K-vhwNIxw'
));