PHPoAuthLib
PHPoAuthLib copied to clipboard
[Google.php] Fatal error: Uncaught exception 'OAuth\Common\Http\Exception\TokenResponseException - failed to open stream
Dear all,
Honestly, I'm focused just on the examples area; in particular on Google authentication where basically the callback Uri doesn't works properly (I suppose) and this following exception thrown by google.php:
Fatal error:
Uncaught exception 'OAuth\Common\Http\Exception\TokenResponseException' with message 'file_get_contents(https://accounts.google.com/o/oauth2/token): failed to open stream: Invalid argument' in C:\xampp\htdocs\PHPoAuthLib-1.0\src\OAuth\Common\Http\Client\StreamClient.php:74 Stack trace: #0 C:\xampp\htdocs\PHPoAuthLib-1.0\src\OAuth\OAuth2\Service\AbstractService.php(93): OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), Array, Array) #1 C:\xampp\htdocs\PHPoAuthLib-1.0\examples\google.php(38): OAuth\OAuth2\Service\AbstractService->requestAccessToken('4/D9_lBTq6zh8Am...') #2 {main} thrown in C:\xampp\htdocs\PHPoAuthLib-1.0\src\OAuth\Common\Http\Client\StreamClient.php on line 74
Any help is appreciated, thank you very much. Cheers SM
Me too have this problem....
i also have a similar problem. The strangest thing is happening. before the check, if $response is empty if i log the response at that stage i see the credentials, however, if i log the credentials after the check the variable is empty. Im at a total loss.
$response = file_get_contents($endpoint->getAbsoluteUri(), false, $context); // if i die($response); here its fine error_reporting($level); if ($false === $response) { // yet it always fails, so if i die here, its empty! $lastError = error_get_last(); if (is_null($lastError)) { throw new TokenResponseException( 'Failed to request resource. HTTP Code: ' . ((isset($http_response_header[0]))?$http_response_header[0]:'No response') ); } throw new TokenResponseException($lastError['message']); }