How to get new token after calling reconnect api of Intuit? [duplicate]

时光毁灭记忆、已成空白 提交于 2019-12-12 04:44:48

问题


I wrote the code to reconnect the Intuit. My code is:

client.reConnect(INTUIT_QB_OAUTH_CONSUMER_KEY,INTUIT_QB_OAUTH_CONSUMER_SECRET,
"accessTOken","accessTokenKeySecret");

I can't be sure about it is working or not. What is the best way to test it? I went through think page of intuit: https://appcenter.intuit.com/Playground/OAuth/IA/ but I don't have so much idea regarding to it.

Another Main issue i am facing it that, How to get new token again?? As defined by intuit checklist, We should not call OauthFlow again.

....................................................................................................................

Added part of question:

I know that, Playground helping me lot. But I am searching a mechanism to get new accessToken and accessTokenSecret after I call reconnect api. I am calling api as follows:

IAPlatformClient client = new IAPlatformClient();
            client.reConnect(INTUIT_QB_OAUTH_CONSUMER_KEY,INTUIT_QB_OAUTH_CONSUMER_SECRET,
"accessTOken","accessTokenKeySecret");

This is working fine, because if i try to use old tokens from database it throws exception as defined by Intuit.

And This code i have to run using scheduler mechanism. After calling reconnect api, I have to update my existing keys on database But I can't get those newly generated keys. So, Please suggest me the mechanism which returns new accessToken and accessTokenSecret.

I have tried this:

Map<String, String> requesttokenmap=client.getRequestTokenAndSecret(INTUIT_QB_OAUTH_CONSUMER_KEY,INTUIT_QB_OAUTH_CONSUMER_SECRET);

then,

final Map<String, String> oauthAccessTokenMap =
             client.getOAuthAccessToken(verifierCode, requesttokenmap.get(IntuitSSOConstants.REQUEST_TOKEN),
             requesttokenmap.get(IntuitSSOConstants.REQUEST_TOKEN_SECRET),
             PropsUtil.get(CommonConstants.INTUIT_QB_OAUTH_CONSUMER_KEY),
             PropsUtil.get(CommonConstants.INTUIT_QB_OAUTH_CONSUMER_SECRET));

But I will not have verifierCode code, which have to pass as a parameter in last block of code.

So, how can I get accessToken and accessTokenSecret?


回答1:


Please refer this SO thread. QuickBook Online Reconnect & expire Issue

For your first Qts, Please check - https://developer.intuit.com/docs/0025_quickbooksapi/0053_auth_auth/oauth_management_api

Please find below steps to get OAuth tokens using which you can make API call against your QBO account. If you create an app in appcenter, you'll get consumerKey and consumerSecret. https://developer.intuit.com/Application/Create/IA

Using the above two tokens, you can generate accessToken and accessSecret from the OAuthPlayground. https://appcenter.intuit.com/Playground/OAuth/IA PN - After completing C2QB(OAuth) flow, you should use 'App Menu API Test.' option which will show you accessToken and accessSecret.

All the above steps are mentioned in this - https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0/0002_synchronous_calls/0001_data_service_apis

Thanks



来源:https://stackoverflow.com/questions/25153317/how-to-get-new-token-after-calling-reconnect-api-of-intuit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!