rangka / quickbooks

PHP Library for connecting to QuickBooks.
MIT License
8 stars 11 forks source link

signature_invalid #2

Closed degecko closed 7 years ago

degecko commented 7 years ago

Hey

I'm trying to generate a token, but when the user gives access to the app and returns on the callback and I execute:

$connector = new Connect;
$result = $connector->connect($_GET);

I get:

Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client error: `GET https://oauth.intuit.com/oauth/v1/get_access_token?oauth_consumer_key=<removed>&oauth_nonce=94XOiIMxq8&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1477409108&oauth_token=qyprdDloPAuo924wDURniAFMgUFgRGigr8OpnRbJta3qRRgj&oauth_verifier=734z6xe&oauth_version=1.0&oauth_signature=PKBdCWeRGTfPF1G20%2F0unTlIEZg%3D` resulted in a `401 Unauthorized` response:
oauth_problem=signature_invalid
 in /Users/gecko/Web/Code/_work/quickbooks/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111
Stack trace:
#0 /Users/gecko/Web/Code/_work/quickbooks/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /Users/gecko/Web/Code/_work/quickbooks/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /Users/gecko/Web/Code/_work/quickbooks/vendor/guzzl in /Users/gecko/Web/Code/_work/quickbooks/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 111

Can you advice to solve this issue?

Thank you, Gecko

khairulashraff commented 7 years ago

It's hard to guess without seeing the entire codebase however the most common problem I face during this phase is incorrect configuration.

On Step 2, Redirection page, an oauth_token_secret will be returned by $connector->requestAccess(), you must set this value into the Configuration before running $connector->connect().

Take note, once authorised this value must be removed and replaced with a new value returned by $connector->connect().

If you're still having problem take a look at the playground: https://github.com/rangka/quickbooks-playground

degecko commented 7 years ago

Thank you so much! That solved it! :)