I have a youtube channel and i'm using the Youtube API v3 to pull a list of videos uploaded in that channel (using the 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 popup that asks me to login and authenticate in order to fetch the details. How can i get rid of this authentication popup? I'm planning to write a cron job that will pull the list of videos periodically and store it in a DB so i do not want that authentication popup.
NOTE : When i try to pull videos from a playlist, i'm not asked any authentication and the api functions smoothly
$playlistItemsResponse = $youtube->playlistItems->listPlaylistItems('snippet,status', array(
'part' => 'snippet,contentDetails',
'maxResults' => 50,
'playlistId' => 'UUGpAMVStIfaQ32K-vhwNIxw'
));