I'm trying to retrieve comment threads for a users video but I'm getting a 403 Insufficient Permission error.
My oAuth client in the developers console has the Youtube Data v3 API enabled and I set the youtube scope when the token is generated.
Here is the client I use to authorize the app in the oauth flow. I've tried both the youtube scope and the youtube.readonly scope and neither expose commenThreads.
$client = new Google_Client(); $client->setClientId($auth_config['client_id']); $client->setClientSecret($auth_config['client_secret']); $client->setRedirectUri($auth_config['redirect_uri'])); $client->addScope(Google_Service_YouTube::YOUTUBE); $client->setAccessType('offline');
Elsewhere in my app I use the token like below.
$client = new Google_Client(); $client->setAccessToken($access_token); $youtube = new Google_Service_YouTube($client); $comments = $youtube->commentThreads->listCommentThreads('snippet', [ 'videoId' => $videoId]);
I can view the users videos and as far as I can tell I should have permission to view comments too. What am I missing? My code is almost identical to the PHP client library example.