2012-07-16 131 views
0

我正在尝试使用Google PHP API从Google plus中搜索内容。我能够获得刷新令牌。但是,当我试图使用该刷新令牌获取访问令牌时,它返回以下错误。Google PHP API离线访问问题

致命错误:未在/ var/www/social-media-test/google-api中发现异常'apiAuthException'消息'错误刷新OAuth2令牌,消息:'{“error”:“invalid_grant”}“ -php-client/src/auth/apiOAuth2.php:242堆栈跟踪:#0 /var/www/social-media-test/google-api-php-client/src/apiClient.php(281):apiOAuth2-> refreshToken('MY-REFRESH-TOKEN-HERE')#1 /var/www/social-media-test/google-api-php-client/examples/plus/p.php(19):apiClient-> refreshToken(' ')#2 {main}扔在/var/www/social-media-test/google-api-php-client/src/auth/apiOAuth2.php上线242

MY代码如下所示。

$client = new apiClient(); 
$client->setApplicationName('Google+ PHP Starter Application'); 
$client->setClientId('client-id'); 
$client->setClientSecret('secret-key'); 
$client->setRedirectUri('http://localhost/index.php/main'); 
$client->setDeveloperKey('dev-key'); 
$plus = new apiPlusService($client); 

$client->refreshToken('MY-REFRESH-TOKEN'); 

任何想法?

回答