title: Quickbooks Online API Oauth2.0 using httr
body: <p>I am trying to access the QuickBooks online API via R. Here is what I have so far:</p>
  
  <pre><code>library(httr)
  library(httpuv)
  
  endPoint &lt;- oauth_endpoint(request = NULL,
                             authorize = "https://appcenter.intuit.com/connect/oauth2",
                             access = "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer")
  App &lt;- oauth_app("Untitled",
                   key = "xxxx",
                   secret = "xxxxx",
                   redirect_uri = "http://localhost:1410/")
  
  QBOtoken &lt;- oauth2.0_token(endpoint = endPoint,
                 app = App,
                 scope = "com.intuit.quickbooks.accounting",
                 type = "code",
                 cache = T)
  GET("https://sandbox-quickbooks.api.intuit.com/v3/company/193514718345164/query?query=Select * from Payment", config(token = QBOtoken))
  </code></pre>
  
  <p>When run the code above through QBOtoken, I go through the whole Oauth2.0 "dance" and get the response:</p>
  
  <pre><code>Waiting for authentication in browser...
  Press Esc/Ctrl + C to abort
  Authentication complete.
  </code></pre>
  
  <p>However, when I execute the GET command, it returns:</p>
  
  <pre><code>Error in self$credentials$access_token : 
    $ operator is invalid for atomic vectors
  </code></pre>
  
  <p>The <code>.httr-oauth</code> file that is generated is filled with 284 rows of 32 characters. Is that normal?</p>
  
  <p>I have connected to the API via Postman and it generates an access token allowing me to execute queries like the GET request in my code. There is also an Oauth 2.0 playground on Intuit Developer. Somehow, in R, I am not getting the access token and refresh token.</p>
  
  <p>Another concern, is that I am currently trying to connect to a development environment. For QuickBooks Online, the redirect URL can be the localhost in the development environment, but if I want to connect to the production company(my company) data I will need a https redirect URL. Will this be possible through R?</p>
  
  <p>My ultimate goal for this project is for the script to automatically run on a nightly basis, connect to the API, and ETL the data into a Relational Database for reporting/analytics purposes. Any help would be greatly appreciated!</p>