Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error (500) while trying to access https://www.googleapis.com/userinfo/email #1

Closed
GoogleCodeExporter opened this issue Dec 16, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. I have written the following "index.php" in order to get the user email:

session_start();

require_once "../src/apiClient.php";
require_once "../src/contrib/apiEasyhybridService.php";

$apiClient = new apiClient();
$user = new apiEasyhybridService($apiClient);

if (isset($_SESSION['oauth_access_token'])) {
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
  $token = $apiClient->authenticate();
  $_SESSION['oauth_access_token'] = $token;
}

$email = $user->getUseremail();
echo "<pre>Email:\n" . print_r($email, true) . "</pre>";

2. I have run the page in a browser.

What is the expected output? What do you see instead?
Expected:
1) Login to google account request
2) Allow the application to access the user email
3) Print the user email

Instead:
1) Login to google account request
2) Allow the application to access the user email
3) Print the following fatal error : 

Fatal error: 
Uncaught exception 'apiServiceException' with message 'Error calling GET 
https://www.googleapis.com/userinfo/email?alt=json: (500) Internal Error' in 
/path/src/io/apiREST.php:85 Stack trace: #0 
/path/src/service/apiServiceResource.php(101): 
apiREST::execute(Object(apiServiceRequest)) #1 
/path/src/contrib/apiEasyhybridService.php(51): 
apiServiceResource->__call('get', Array) #2 /path/examples/index.php(84): 
apiEasyhybridService->getUseremail() #3 {main} thrown in 
/path/src/io/apiREST.php on line 85

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

I use the 0.2 version on a LAMP server.

Please provide any additional information below.

I have been able to reproduce this behavior on the google Oauth playground
(http://googlecodesamples.com/oauth_playground/index.php). On the sixtieth 
step, if you try to access to https://www.googleapis.com/userinfo/email with 
"Stick oauth_* params in: Authorization header" everything works fine and it 
returns the user email whereas is you try to access it with "Stick oauth_* 
params in: URL as params" it returns an internal error.

So my opinion was that the parameter "?alt=json" was not properly handled and 
it was the reason why the server was returning this internal error. So I 
managed to remove this parameter from the URL just to figure out if the access 
request was working but I got the same result...

I would be very grateful if you could find a workaround or explain me what I am 
doing wrong .

Thanks for your time.

Original issue reported on code.google.com by marboeu...@gmail.com on 24 Nov 2010 at 9:59

@GoogleCodeExporter
Copy link
Author

Here's a small code snippet to help you use the userinfo/email API.

https://groups.google.com/d/msg/google-api-php-client/o1BRsQ9NvUQ/xa532MxegFIJ

Original comment by chirags@google.com on 14 Dec 2011 at 10:18

  • Changed state: Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant