First of all sorry for bad english. I am using Google Sheets API for my web project and I am following Google Sheets API documentation. OAuth 2.0 flow is going well and I am getting access token but when control reach the $response = $service->spreadsheets_values->get($spreadsheetId,$range);
it shows localhost is currently unable to handle this request. HTTP ERROR 500
. I am also using ngrok to expose my localhost to google
require_once APPPATH."third_party/googleClientLibrary/vendor/autoload.php";
session_start();
$client = new Google_Client();
$client->setAuthConfig(APPPATH."third_party/googleClientLibrary/client_secret.json");
$client->setScopes(Google_Service_Sheets::SPREADSHEETS_READONLY);
$client->setAccessType('offline');
$client->authenticate($_GET['code']);
$_SESSION['access_token']= $client->getAccessToken();
if (isset($_SESSION['access_token']))
{
$client->setAccessToken($_SESSION['access_token']);
$service = new Google_Service_Sheets($client);
$spreadsheetId = '1Wr_6u4fO7NNWHeYsdTm0S-z9UU3NtPMdwIhkrSAfEpA';
$range = 'Test-sheet!A:E';
$response = $service->spreadsheets_values->get($spreadsheetId,$range);
$values = $response->getValues();
}`