Ошибка при обработке аутентификации OAuth2

Я следую этому руководству, чтобы получить учетные данные из Google, но для области API youtube вместо API-интерфейса.

Я пробовал с этим:

<?php session_start(); require 'Google/Client.php'; require 'config.php'; //$_SESSION = array(); $client = new Google_Client(); $client->setApplicationName('Test APPS'); $client->setClientId($clientId); $client->setClientSecret($clientSecret); $client->setScopes($scope); $client->setRedirectUri($redirectUri); $client->setAccessType($accessType); if(isset($_GET['code'])){ $client->authenticate($_GET['code']); $_SESSION['token'] = $client->getAccessToken(); header('Location:' . $redirectUri); } if(!isset($_SESSION['token'])){ $url = $client->createAuthUrl(); ?> <a href="<?php echo $url; ?>">Connect</a> <?php } ?> 

после нажатия на соединение я был перенаправлен на аутентификацию google, и у меня есть область авторизации, но при получении кода в URL-адресе я получил ошибку.

это трассировка ошибки

 Fatal error: Uncaught exception 'Google_IO_Exception' with message 'HTTP Error: Unable to connect: 'fopen(https://accounts.google.com/o/oauth2/token) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Invalid argument'' in C:\wamp\www\test\Google\IO\Stream.php:112 Stack trace: #0 C:\wamp\www\test\Google\IO\Abstract.php(125): Google_IO_Stream->executeRequest(Object(Google_Http_Request)) #1 C:\wamp\www\test\Google\Auth\OAuth2.php(113): Google_IO_Abstract->makeRequest(Object(Google_Http_Request)) #2 C:\wamp\www\test\Google\Client.php(135): Google_Auth_OAuth2->authenticate('4/yNyAID-0XYagI...') #3 C:\wamp\www\test\index.php(18): Google_Client->authenticate('4/yNyAID-0XYagI...') #4 {main} thrown in C:\wamp\www\test\Google\IO\Stream.php on line 112 

любая идея о первопричине?

Solutions Collecting From Web of "Ошибка при обработке аутентификации OAuth2"