Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Get 50% OFF QuickBooks for 3 months*
Buy nowI'm having the same error. See the following code.
$settings = [
'auth_mode' => 'oauth2',
'ClientID' => 'client id',
'ClientSecret' => 'client secret',
'RedirectURI' => 'http://example.test/redirect',
'accessTokenKey' => 'token key',
'refreshTokenKey' => 'refresh token key',
'QBORealmID' => 'my realm',
'scope' => 'com.intuit.quickbooks.accounting',
'baseUrl' => 'Development'
];
$dataService = DataService::Configure($settings);
$OAuth2LoginHelper = $dataService->getOAuth2LoginHelper();
try {
$refreshedAccessTokenObj = $OAuth2LoginHelper->refreshToken();
} catch (\Exception $exception) {
// throws exception, answer from QBO
// Incorrect Token type or clientID
var_dump($exception);
}
$error = $OAuth2LoginHelper->getLastError();
if($error){
echo 'got error'.PHP_EOL;
var_dump($error);
} else {
echo 'update auth token'.PHP_EOL;
//Refresh Token is called successfully
$dataService->updateOAuth2Token($refreshedAccessTokenObj);
}
// the token is valid
// I can see company info
echo 'get company info'.PHP_EOL;
print_r($dataService->getCompanyInfo());