intuit partner platform - Inuit QuickBooks Token Renewal and Expiration -
i using qb desktop edition. , wanted renew/regenerate 'access tokens'/'access token secrete' quickbooks desktop edition getting expired in 180 days , renewal must made within 30 days of token expiry. have tried same below code not working, gives error as,
<restresponse xmlns="http://www.intuit.com/sb/cdm/v2"><error requestid="14aa97c48321489db48254e4bdb25d00"><requestname>errorrequest</requestname><processedtime>2013-04-05t11:43:08+00:00</processedtime><errorcode>401</errorcode><errordesc>invalid security token</errordesc></error></restresponse>
there no logged request/response token generatetion.
string myrealmid = "000000000000000"; string myaccesstoken = "0000000000000000000000000000000000000"; string myaccesstokensecret = "00000000000000000000000000000000000"; string myapptoken = "00000000000000000000000000000000000"; string myconsumerkey ="00000000000000000000000000000000000"; string myconsumersecret ="00000000000000000000000000000000000"; oauthconsumercontext consumercontext = new oauthconsumercontext { consumerkey =myconsumerkey, signaturemethod = signaturemethod.hmacsha1, consumersecret = myconsumersecret }; oauthsession osession = new oauthsession(consumercontext, "https://oauth.intuit.com/oauth/v1/get_request_token", "https://workplace.intuit.com/connect/begin", "https://oauth.intuit.com/oauth/v1/get_access_token"); osession.consumercontext.useheaderforoauthparameters = true; osession.accesstoken = new tokenbase { realm = myrealmid, token = myaccesstoken, consumerkey = myconsumerkey, tokensecret = myaccesstokensecret }; var body = "<advancedreportquery xmlns=\"http://www.intuit.com/sb/cdm/v2\" xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" xsi:schemalocation=\"http://www.intuit.com/sb/cdm/v2 ..//restdatafilter.xsd\"><balancesheetstd><offeringid>ipp</offeringid><endtransactiondate>2012-06-01</endtransactiondate></balancesheetstd></advancedreportquery>"; iconsumerrequest conreq = osession.request(); conreq = conreq.post().withrawcontenttype("text/xml").withrawcontent(system.text.encoding.ascii.getbytes(body)); conreq = conreq.forurl("https://services.intuit.com/sb/advancedreport/v2/508053445"); try { conreq = conreq.signwithtoken(); } catch (exception ex) {} string serviceresponse = conreq.readbody(); } catch (exception err) {} }
thanks,
reshma d.
you need call reconnect api within 30 days prior token expiration. looks tokens have expired, need go through oauth flow again.
http://docs.developer.intuit.com/0025_intuit_anywhere/0060_reference/3002_reconnect_api
c# example using devdefined , devkit:
Comments
Post a Comment