diff --git a/gapi.class.php b/gapi.class.php index 7ee4d8b..bcde336 100644 --- a/gapi.class.php +++ b/gapi.class.php @@ -609,7 +609,11 @@ public function fetchToken($client_email, $key_file, $delegate_email = null) { $data = $this->base64URLEncode(json_encode($header)) . '.' . $this->base64URLEncode(json_encode($claimset)); if (!file_exists($key_file)) { - throw new Exception('GAPI: Failed load key file "' . $key_file . '". File could not be found.'); + if ( !file_exists(__DIR__ . DIRECTORY_SEPARATOR . $key_file) ) { + throw new Exception('GAPI: Failed load key file "' . $key_file . '". File could not be found.'); + } else { + $key_file = __DIR__ . DIRECTORY_SEPARATOR . $key_file; + } } $key_data = file_get_contents($key_file);