intuitdeveloper / helloworld-php Goto Github PK
View Code? Open in Web Editor NEWStarter app in PHP using OAuth2 that demonstrates how to make a QBO API Call
License: Apache License 2.0
Starter app in PHP using OAuth2 that demonstrates how to make a QBO API Call
License: Apache License 2.0
I'm using PHP SDK and this HelloWorld example. I've set the log location with $dataService->setLogLocation("path/to/my/log/dir") but I'm not seeing any logs. I am also calling $dataService->enableLog() to make sure that logging is enabled. I've made sure the the directory has the correct permissions and even 777'd it and still no luck. The only way I've been able to get this to work is by hacking the core file at v3-php-sdk\src\Core\CoreConstants.php and changing const DEFAULT_LOGGINGLOCATION = "/tmp/IdsLogs"; to my log location. That obviously won't be acceptable on a production environment. Am I missing something here?
The below mentioned code works in php8.0
https://github.com/IntuitDeveloper/HelloWorld-PHP
With php7.4, it shows error
Notice: session_start(): A session had already been started - ignoring in /var/www/wordpress/qb-oauth/index.php on line 14
Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "QuickBooksOnline\API\Core\OAuth\OAuth2\OAuth2AccessToken" of the object you are trying to operate on was loaded before unserialize() gets called or provide an autoloader to load the class definition in /var/www/wordpress/qb-oauth/index.php on line 37
which corresponds to these functions
'access_token' => $accessToken->getAccessToken(),
'refresh_token' => $accessToken->getRefreshToken(),
'x_refresh_token_expires_in' => $accessToken->getRefreshTokenExpiresAt(),
'expires_in' => $accessToken->getAccessTokenExpiresAt()
(Same folder code with hosted with PHP 8.0 localhost , it works, but with same folder and php7.4, we get above FATAL error)
Workaround: Use php8.0, remove php7.4
URL for testing
When clicking the "Connect to QuickBooks" button for the first time, a popup appears which displays a log-in page to QuickBooks. After logging in, a loading splash screen appears and then the pop-up suddenly closes. Looking at the browser console, I get the error stated in the title above. I suspect it has something to do with the site failing to obtain the access token from the pop-up because the pop-up's page has a different origin?
running composer install gets this response
$ composer install
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Symfony/Component/Console/Command/DumpCompletionCommand.php:48
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Symfony/Component/Console/Command/DumpCompletionCommand.php:56
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:879
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/Autoload/AutoloadGenerator.php:884
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in /usr/share/php/Composer/DependencyResolver/Problem.php:366
Your requirements could not be resolved to an installable set of packages.
It also then complains about not finding php extensions that are installed
When I try to connect to quickbook using php server to make my accounting app using the accounting api I get :
fatal error: uncaught quickbooksonline\api\exception\sdkexception: [0]: the code is not set. can't exchange for oauth 2 access token. thrown in /applications/xampp/xamppfiles/htdocs/helloworld-php/vendor/quickbooks/v3-php-sdk/src/core/oauth/oauth2/oauth2loginhelper.php on line 218.
I entered my keys correctly and didn't touch anything else, I also installed the v3-php-sdk
I am getting this error when running composer install
with a clone of this repo:
[Composer\Json\JsonValidationException]
./composer.json does not match the expected JSON schema:
- name : Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$
It seems composer needs a '/' in the name field. I tried replacing the '-' with a '/', as below and it seems to get past this issue:
{
"name": "intuit/demos-webhooks"
....
but I don't know if that is the correct fix or not...just a test and it seemed to work.
I have gone through the sample code, I have been able to successfully redirect to and from intuit server after clicking the connect button. When I look at my callback url , I realized that $_SERVER['QUERY_STRING']
is empty, and parseAuthRedirectUrl
gives error because code is not defined in $qsArray['code']
.
Please note that I am using a development environment and pretty url's like mysite/some-link
.
Thank you!
Hi
Just now i am implementing the this app. I am successfully getting companyInfo. But when i use my samples examples I am getting the bellow error.
The Status code is: 401
The Helper message is: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
The Response message is: General Authentication ErrorAuthenticationErrorGeneral: SRV-110-Authentication Failure , statusCode: 401
Please help me on this issue . why i am getting this issue.
Thanks
DOMException
code: 18
columnNumber: 0
data: null
filename: "https://my domain with SSL/quick_book/"
lineNumber: 33
message: "Permission denied to access property "document" on cross-origin object"
Code from Browser...
`
var win = window.open(url, 'connectPopup', parameters);
var pollOAuth = window.setInterval(function () {
try {
if (win.document.URL.indexOf("code") != -1) {
window.clearInterval(pollOAuth);
// win.close();
location.reload();
}
} catch (e) {
console.log(e)
}
}, 100);
`
it's defined but it's never used.
is the example supposed to require a login after an hour every time? Is this an oversite?
Hello,
How I can fetch balance info ? is there any method created in this ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.