sscarpa / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

Service account authentication failed : Unable to sign data #183

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Try to use OAuth 2.0 for Server to Server Applications by passing the 
service account name and private key in $client->setAssertionCredentials(new 
Google_AssertionCredentials

What is the expected output? What do you see instead?

There is the following error : 
Fatal error: Uncaught exception 'Google_AuthException' with message 'Unable to 
sign data' in google-api-php-client-read-only/src/auth/Google_P12Signer.php:64

What version of the product are you using? On what operating system?

google-api-php-client - Linux Gentoo

Please provide any additional information below.

Maybe a pb of algorithm in line 64: openssl_sign($data, $signature, 
$this->privateKey, "sha256")
If replaced by OPENSSL_ALGO_SHA1, it seems to pass but invalid_grant access 
appears.

Original issue reported on code.google.com by jpage...@gmail.com on 1 Sep 2012 at 10:21

GoogleCodeExporter commented 8 years ago
sha256 is supported in PHP 5.3. Which version of PHP are you using?

Original comment by chirags@google.com on 11 Sep 2012 at 8:07

GoogleCodeExporter commented 8 years ago
You're right ! 
I use 5.2.17

Thanks 4 your reply

Original comment by jpage...@gmail.com on 11 Sep 2012 at 9:00

GoogleCodeExporter commented 8 years ago
I'm seeing what I believe is this same issue with php version 5.3.6. The OS is 
unknown, as the issue occurs on a Yahoo hosted site.  Logs from hosted server 
are:

[23-Jan-2013 12:08:57] PHP Warning:  openssl_sign() [<a 
href='function.openssl-sign'>function.openssl-sign</a>]: Unknown signature 
algorithm. in /n5448p/google/auth/Google_P12Signer.php on line 65
[23-Jan-2013 12:08:57] PHP Fatal error:  Uncaught exception 
'Google_AuthException' with message 'Unable to sign data' in 
/n5448p/google/auth/Google_P12Signer.php:66
Stack trace:
#0 /n5448p/google/auth/Google_AssertionCredentials.php(90): 
Google_P12Signer->sign('<omitted>')
#1 /n5448p/google/auth/Google_AssertionCredentials.php(72): 
Google_AssertionCredentials->makeSignedJwt(Array)
#2 /n5448p/google/auth/Google_OAuth2.php(255): 
Google_AssertionCredentials->generateAssertion()
#3 /n5448p/google/auth/Google_OAuth2.php(209): 
Google_OAuth2->refreshTokenWithAssertion()
#4 /n5448p/google/service/Google_ServiceResource.php(166): 
Google_OAuth2->sign(Object(Google_HttpRequest))
#5 /n5448p/google/contrib/Google_CalendarService.php(569): 
Google_ServiceResource->__call('list', Array)
#6 /n5448p/index.php(40): 
Google_EventsServiceResource->listEvents('<omitted>@gmail.co...', Array)
#7 {main}
  thrown in /n5448p/google/auth/Google_P12Signer.php on line 66

Original comment by n54...@gmail.com on 23 Jan 2013 at 8:14

GoogleCodeExporter commented 8 years ago
We're clearing up old issues - could you reopen this if you're still seeing the 
problem? AFAIK this is working on 5.3+

Original comment by ianbar...@google.com on 22 Mar 2013 at 3:27