hi
i get PHP Fatal error: Uncaught exception 'LogicException' with message 'refresh token must be passed in or set as part of setAccessToken' when trying to access my account whith this script.
require_once 'src/Google/autoload.php';
require_once 'Mybusiness.php';
define('APPLICATION_NAME', 'google_api');
define('CREDENTIALS_PATH', 'credentials.json');
define('CLIENT_SECRET_PATH', 'client_secret2.json');
$redirect_uri = 'urn:ietf:wg:oauth:2.0:oob';
$client = new Google_Client();
$client->setApplicationName(APPLICATION_NAME);
$client->setAuthConfigFile(CLIENT_SECRET_PATH);
$client->setRedirectUri($redirect_uri);
$client->setAccessType("offline");
$client->setApprovalPrompt("force");
$mybusinessService = new Google_Service_Mybusiness($client);
$credentialsPath = CREDENTIALS_PATH;
if (file_exists($credentialsPath)) {
$accessToken = file_get_contents($credentialsPath);
$client->setAccessToken($accessToken);
if ($client->isAccessTokenExpired()) {
$client->refreshToken($client->getRefreshToken());
file_put_contents($credentialsPath, $client->getAccessToken());
}
} else {
$authUrl = $client->createAuthUrl();
}
$rslt_data=$mybusinessService->accounts_locations->listAccountsLocations('accounts/xxxxxxxxxxxxxxxxxxxxx');
echo $rslt_data;
thx for the help