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