I have been trying to find an example which grabs the list of a user's subscriptions, with no success. While I have tried to HTTP GET method via https://www.googleapis.com/youtube/v3/subscriptions, with mine=true and part=snippet,id, it seems to always return an Invalid Credentials error. I have tried it using headers necessary (I believe) from Google Cloud Console, but could not find an Authorization token to use. Though this may not be the method I am looking for.
I think the PHP frontend would make more sense to use, but I simply don't know where to start with it, as I can't find an example that works. What I intend to do is for the server to get a list of the user's subscriptions (through the account the user is signed-in on YouTube) to search for a certain channel subscription -- but I can't seem to get even the first part working with all of these authorization credentials that are mentioned in some documentations but not present because of layout changes. An example would help me out greatly, as I have been stuck on this seemingly simple task for hours. Perhaps v2 of the API would be simpler to use, but I have tried both versions and my mind is now boggled.
A lazy example using PHP with Google's API:
$subList = $youtube->subscriptions->list(array('part'=>'id,snippet','mine'=>'true', 'maxResults'=>'50'));
// Store channel ids into array. items -> snippet -> resourceId -> channelId
foreach($subList['items'] as $item) {
$subArray[] = $item['snippet']['resourceId']['channelId'];
}
// If there are more pages, go to next page, pageToken = nextPageToken
while ($subList['nextPageToken']) {
$nextPage = $subList['nextPageToken'];
$subList = $youtube->subscriptions->list(array('part'=>'id,snippet','pageToken'=>$nextPage,'mine'=>'true','maxResults'=>'50'));
// Store channel ids into array.
foreach($subList['items'] as $item) {
$subArray[] = $item['snippet']['resourceId']['channelId'];
}
}