0

google plus api 経由で Youtube ユーザー名を取得しようとしています。私は Plus ang YT api の php サービスを使用しており、symfony 2 を使用しています。Google plus サービスにも問題はありません。承認後、必要なすべての情報を取得しています。YT の場合、エラーが発生しました:不十分なアクセス許可エラーだから、ここでアクセス トークンのスコープを確認します: https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=ACCESS_TOKEN とアクセス トークンのスコープはGoogle Plus、私はGoogle Api php clinetを強制してYTスコープも実行可能にすることができません。何か案は?

これが私のコードです:

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()); 
}
4

1 に答える 1