0

I am trying to run Google oAuth Service Account by specifying keyfilelocation as below:

$client_id = 'xccsssds-ib5c5qmr7n34aifss95ue7qouplh7v3r.apps.googleusercontent.com'; //Client ID
$service_account_name = 'sdfdsfsxxxxxxxxxsdfdsf-ib5c5qmr7n34aifss95ue7qouplh7v3r@developer.gserviceaccount.com'; //Email Address
$key_file_location = 'My Cloud Project-e2a5b459dfd9.p12'; //key.p12 

But my server is throwing error like:

file_get_contents(My Cloud Project-e2a5b459dfd9.p12): failed to open stream: No such file or directory in XXXXXXXXXX
Uncaught exception 'Google_Auth_Exception' with message 'Unable to parse the p12 file. Is this a .p12 file? Is the password correct? OpenSSL error: ' 

Path of the p12 file correct and gave file permissions correctly but it was throwing this error.

LaurentG
  • 474
  • 4
  • 16
Sekhar Babu
  • 368
  • 2
  • 8
  • 27
  • can you include your full file_get_contents line. As the error message states it cant find the file. as a test try putting it in the same dir as the file and see if it works. – Linda Lawton - DaImTo Jan 06 '15 at 07:43
  • p12 file was in same directory as this service page is there, and more over file_get_contents was reading all other files, except this file, and my php version is 5.4 , is that the any problem. – Sekhar Babu Jan 06 '15 at 08:51
  • here is a working example using the Calendar API. http://www.daimto.com/google-calendar-api-with-php-service-account/ – Linda Lawton - DaImTo Jan 06 '15 at 09:00
  • thanks, i saw that link, the same i followed but my server is not reading this p12 file, i checked that using is_readable function, it returns false, may be problem with my server – Sekhar Babu Jan 06 '15 at 09:14
  • linux or windows? rename the file crap.p12 could it be the spaces in the name causing a problem? – Linda Lawton - DaImTo Jan 06 '15 at 09:42
  • linux, hostgator, may be no permission to read certificates in this server, contacting support. – Sekhar Babu Jan 06 '15 at 09:47
  • what are the permissions set to on the file? php needs to be able to read it and php normally runs as some weird user NOBODY if I remember. – Linda Lawton - DaImTo Jan 06 '15 at 10:01

0 Answers0