INTUIT JAVA API: AUTHORIZATION (JAVA TO QUICKBOOKS ONLINE INTEGRATION)

Basic code for REQUEST TOKEN, REQUEST TOKEN SECRET & Authorization URL:

void GetRequestToken() {
        // Invoke the helper class and retrieve the request token.
        OAuthConsumer oauthconsumer;       
        // Initialize the Provider class with the request token, access token and authorize URLs
        OAuthProvider provider = new DefaultOAuthProvider(<REQUEST_TOKEN_URL>, <ACCESS_TOKEN_URL>, <AUTHORIZE_URL>);
        try {
                oauthconsumer = new DefaultOAuthConsumer("<OAUTH_CONSUMER_KEY>", "<OAUTH_CONSUMER_SECRET>");
                // The retrieveRequestToken method in the signpost library calls the request token URL configured in the OAuthProvider object
                // to retrieve the token and sends the response to the URL configured in the Oauth Callback URL configured in the properties file
                String authUrl = provider.retrieveRequestToken(oauthconsumer, "https://oauth.intuit.com/oauth/v1/get_request_token");
                       
                System.out.println("AuthURL - " + authUrl);
                System.out.println("RequestToken - " + oauthconsumer.getToken());
                System.out.println("RequestTokenSecret - " + oauthconsumer.getTokenSecret());           
         System.out.println(provider.getAccessTokenEndpointUrl());                
            } catch (Exception e) {
            e.printStackTrace();
        }
    } 


Basic code for ACCESS TOKEN and ACCESS TOKEN SECRET: 

void GetAccessToken() {

        OauthHelper oauthhelper = new OauthHelper();     
        final Map<String, String> accesstokenmap = oauthhelper.getAccessToken(
                "<OAUTH_VERIFIER>",
                                "<REQUEST_TOKEN>",
                                "<REQUEST_TOKEN_SECRET>");
    }

 

Basic code for DataService object: 

DataService GetService(String <OAUTH_CONSUMER_KEY>, String <OAUTH_CONSUMER_SECRET>, String <ACCESS_TOKEN>, String <ACCESS_TOKEN_SECRET>, String realmId) throws FMSException {       


        IAuthorizer authorizer = new OAuthAuthorizer(<OAUTH_CONSUMER_KEY>, <OAUTH_CONSUMER_SECRET>, <ACCESS_TOKEN>, <ACCESS_TOKEN_SECRET>);
        Context context = new Context(authorizer, ServiceType.QBO, realmId);
        DataService service = new DataService(context);

        return service;
    }

2 comments:

  1. This Article is Really Fantastic And Thanks For Sharing The Valuable Post..Issues With Quicken Software Dial Or Visit Quicken Bill Pay Support ! Get Instant Help and Support from Quicken Certified Experts.You Do Not Want To Get Hold Of The Quicken Support Online Or Be Looking For Opening Hours For Quicken Support Team.

    ReplyDelete
  2. This is Really Fantastic And Thanks For Sharing The Valuable Post..Issues With Quicken Software Dial Visit Quicken Support Phone Number +1(888)586-5828 Toll-free !Get Instant Help and Support from Quicken Certified Experts.You Do Not Want To Get Hold Of The Quicken Support Online Or Be Looking.

    ReplyDelete