0
自从他们在11月关闭服务后,我正在将我的谷歌日历访问权限从Zend迁移到新的Google API。我的网络应用程序使用谷歌API来创建一些事件。未捕获的异常'Google_Auth_Exception'带有'Invalid code'消息
我面临一个反复出现的消息,我无法解析:未捕获的异常“Google_Auth_Exception”有消息“无效代码”
这里是我的代码:
define('STDIN',fopen("php://stdin","r"));
require_once '../../utils/google-api-php-client-master/autoload.php';
/**********************
OAUTH 2.0 AUTHORIZATION
***********************/
$client = new Google_Client();
// OAuth2 client ID and secret can be found in the Google Developers Console.
$client->setClientId('XXXXXX);
$client->setClientSecret('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$client->setRedirectUri('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$client->addScope('https://www.googleapis.com/auth/calendar');
$service = new Google_Service_Calendar($client);
$authUrl = $client->createAuthUrl();
//Request authorization
print "Please visit:\n$authUrl\n\n";
print "Please enter the auth code:";
echo(trim(fgets(STDIN)));
$authCode = trim(fgets(STDIN));
// Exchange authorization code for access token
$accessToken = $client->authenticate($authCode);
$client->setAccessToken($accessToken);
有人能帮助我吗?
检查此链接http://stackoverflow.com/questions/26983039/zend-gdata-not-working-with-google-calendar-api其中有关于Zend的迁移细节步骤将Google日历API第3版。 – SGC 2014-12-03 18:47:16