Obtain youtube username from google Plus api - access token scope insufficientPermissions -


i'm trying youtube username via google plus api. use php services plus ang yt api , i'm using symfony 2. obtaining access token works ok, , i'm not going put here. there no problem google plus service, after authorization i'm getting information need. in yt case, i'm getting error : insufficientpermissions error check access token scope in here: https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=access_token , scope of access token google plus, i'm not able force google api php clinet make yt scope aviable too. ideas?

here code :

require_once '../src/google_api_php_client/src/google_client.php'; require_once '../src/google_api_php_client/src/contrib/google_plusservice.php'; require_once '../src/google_api_php_client/src/contrib/google_youtubeservice.php';  $client = new google_client(); $client->setscopes('https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/plus');  $youtube = new google_youtubeservice($client);  if(!empty($allr['code'])){     $client->setclientid('clientidxxx');     $client->setclientsecret('secretxxx');       $client->setredirecturi('postmessage');     $client->authenticate($allr['code']);     $token = json_decode($client->getaccesstoken());  } 

first of all, make sure enabled youtube data api v3 rom devconsole.

then instead of setting scopes, try setting client id , secret devconsole.

$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 object used make data api requests. $youtube = new google_youtubeservice($client);  $plus = new $youtube = new google_plusservice($client); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -