php - PHPSample OAuth connect QBO 401 -


i trying connect quickbooks online. have tried several packages including phpsample, sample code within v3 sdk, , java example time accounting. end similar problem in each.

i able connect quickbooks, , retrieve realmid, oauth token , oauth secret.

in state, able disconnect.

when subsequently connect , try query data (for example, accounts) 401 error.

here return info (with keys removed)

error: invalid auth/bad request (got 401, expected http/1.1 20x or  redirect) response: 401 - message=applicationauthenticationfailed;                errorcode=003200;               statuscode=401               signaturebasestring: post                                    &https%3a%2f%2fsandbox-quickbooks.api.intuit.com%2fv3%2fcompany%2f<realm_id>%2fquery&minorversion%3d3%26oauth_consumer_key%3d<consumer_key%26oauth_nonce%3d2172856b0bd6c51a491.36540409%26oauth_signature_method%3dhmac-sha1%26oauth_timestamp%3d1454423404%26oauth_token%3d<oauth_token>%26oauth_version%3d1.0  array(6) {   ["sbs"]=> string(369) "post&https%3a%2f%2fsandbox-quickbooks.api.intuit.com%2fv3%2fcompany%2f<realm_id>%2fquery&minorversion%3d3%26oauth_consumer_key%3di360v9tvxgou7uobyesjfuirakvq8oqfv4cbl2on%26oauth_nonce%3d2172856b0bd6c51a491.36540409%26oauth_signature_method%3dhmac-sha1%26oauth_timestamp%3d1454423404%26oauth_token%3dqyprdwbrfbyvecjdjda98qr6g9opvreu65euftfomxs5upxp%26oauth_version%3d1.0"   ["headers_sent"]=> string(532) "post /v3/company/<realm_id>/query?minorversion=3 http/1.1 host: sandbox-quickbooks.api.intuit.com user-agent: v3phpsdk2.2.0 accept: */* connection: close content-type: application/text authorization: oauth oauth_consumer_key="<consumer_key>",oauth_signature_method="hmac-sha1",oauth_nonce="2172856b0bd6c51a491.36540409",oauth_timestamp="1454423404",oauth_version="1.0",oauth_token="<oauth_token>",oauth_signature="<alpha_num_string>" content-length: 53"   ["headers_recv"]=> string(147) "http/1.1 401 unauthorized server: nginx/1.8.0 date: tue, 02 feb 2016 14:29:35 gmt content-type: text/xml content-length: 797 connection: close"   ["body_sent"]=> string(53) "select * account startposition 1 maxresults 1000"   ["body_recv"]=> string(797) " message=applicationauthenticationfailed; errorcode=003200; statuscode=401 signaturebasestring: post&https%3a%2f%2fsandbox-quickbooks.api.intuit.com%2fv3%2fcompany%2f<realm_id>%2fquery&minorversion%3d3%26oauth_consumer_key%3d<consumer_key>%26oauth_nonce%3d2172856b0bd6c51a491.36540409%26oauth_signature_method%3dhmac-sha1%26oauth_timestamp%3d1454423404%26oauth_token%3d<oauth_token>%26oauth_version%3d1.0 "   ["info"]=> string(1280) "adding handle: conn: 0x3a3c70 adding handle: send: 0 adding handle: recv: 0 curl_addhandletopipeline: length: 1 - conn 5 (0x3a3c70) send_pipe: 1, recv_pipe: 0 connect() sandbox-quickbooks.api.intuit.com port 443 (#5) trying 12.149.173.155... connected sandbox-quickbooks.api.intuit.com (12.149.173.155) port 443 (#5) sslv3, tls handshake, client hello (1): sslv3, tls handshake, server hello (2): sslv3, tls handshake, cert (11): sslv3, tls handshake, server finished (14): sslv3, tls handshake, client key exchange (16): sslv3, tls change cipher, client hello (1): sslv3, tls handshake, finished (20): sslv3, tls change cipher, client hello (1): sslv3, tls handshake, finished (20): ssl connection using aes256-sha256 server certificate: subject: c=us; st=california; l=san diego; o=intuit inc.; ou=tech ops; cn=*.api.intuit.com start date: 2015-11-23 00:00:00 gmt expire date: 2016-11-23 23:59:59 gmt issuer: c=us; o=symantec corporation; ou=symantec trust network; cn=symantec class 3 secure server ca - g4 ssl certificate verify result: self signed certificate in certificate chain (19), continuing anyway. upload sent off: 53 out of 53 bytes server nginx/1.8.0 not blacklisted closing connection 5 sslv3, tls alert, client hello (1): " }  error message: message=applicationauthenticationfailed; errorcode=003200; statuscode=401 signaturebasestring: post&https%3a%2f%2fsandbox-quickbooks.api.intuit.com%2fv3%2fcompany%2f<realm_id>%2fquery&minorversion%3d3%26oauth_consumer_key%3d<consumer_key>%26oauth_nonce%3d2172856b0bd6c51a491.36540409%26oauth_signature_method%3dhmac-sha1%26oauth_timestamp%3d1454423404%26oauth_token%3d<oauth_token>%26oauth_version%3d1.0  note   <consumer_key> matches listed in app page on intuit under oauth consumer key   <oauth_token> matches returned connect quickbooks oauth token   <realm_id> matches returned connect quickbooks realm id   <alpha_num_string> string of alpha numeric characters (which key string) not recognize coming somewhere else. 

i sure doing simple wrongly, cannot see it. advice appreciated.

thanks in advance.

please see sandbox keys , base url need use here- please refer- https://developer.intuit.com/v2/blog/2014/10/20/changes-to-ipp-app-tokens https://developer.intuit.com/blog/2014/10/24/intuit-developer-now-offers-quickbooks-sandboxes edit: if have used dev app keys/tokens , sandbox url oauth should work fine. 401 tokens expired/invalidated error , can occur in following cases-401 errors occur when users other master admin try login realm or wrong email id used login. can happen when other user or master admin tries use connect quickbooks button again same realm using same tokens if master admin deleted in qbo company. reason when admin disconnects realm/company manually invalidates tokens. 401 can occur when there outages @ our end.

the obvious reason 180 days expiry of tokens. apart service issues @ our end can disconnect tokens/invalidate tokens , give 401 errors @ end.

to regenerate tokens- if 180 days not on , days left token expiry>30 days/180 days over, email them disconnect , reconnect using connect quickbooks button. if 180 days going on , days left token expiry within 30 days, system needs use reconnect apis renew existing tokens. https://developer.intuit.com/v2/docs/0050_quickbooks_api/0020_authentication_and_authorization/oauth_management_api


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -