Does Google calendar PHP API check request domain?
I'm in the process of migrating a PHP site to a new server.
The existing site correctly logs in to Google calendar API via PHP which
enables the PHP to create/modify events in my Google calendar as I add
events to my sites own database.
I've copied the PHP and Databse to the new server, which I am accessing
through an /~ style URL while I try to get it all up and running prior to
switching the DNS over to point at the new server.
Hitting that URL gives me an error from the Google/Zend stuff about
authentication:
Authentication with Google failed. Reason: BadAuthentication
To check the username/password I successfully logged in to Google calendar
manually via the Google website.
So I'm happy the credentials are correct. Only thing I can think of at the
moment is that it's a problem authenticating because the request comde
from the IP address instead of the domain.
I don't recall (set this up a few years back) if I needed to allow access
to the API for my Google calendar from specific domains or now, or how I
could add this IP address while setting things up...
Some code:
require_once('ZendGdata-1.11.0/library/Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
try {
$calendarService = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; //
predefined service name for calendar
$calendarClient =
Zend_Gdata_ClientLogin::getHttpClient('<email>','<pwd>',$calendarService);
$gdataCal = new Zend_Gdata_Calendar($calendarClient);
$this->db->setZendGdataCalendar($gdataCal);
} catch(Zend_Gdata_App_HttpException $e) {
$this->db->setZendGdataCalendar(null);
}
Error message refers to the line:
Zend_Gdata_ClientLogin::getHttpClient
No comments:
Post a Comment