I am trying to connect to a few different QuickBooks online accounts through their API (intuit.developer). I have found this SO post resourceful: https://stackoverflow.com/questions/49187064/quickbooks-online-api-oauth2-0-using-httr
When I run this code:
library(httr) library(httpuv) library(curl) library(jsonlite) library(base64enc) endPoint <- oauth_endpoint( request = NULL, authorize = "https://appcenter.intuit.com/connect/oauth2", access = "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer" ) App <- oauth_app( "QBOR Dev", key = my_key, secret = my_secret, redirect_uri = "https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl" ) QBOtoken <- oauth2.0_token( endpoint = endPoint, app = App, scope = "com.intuit.quickbooks.accounting", type = "code", cache = TRUE )
This opens a browser with a login. I sign in and get prompted to select a company and a client. I select my company and client to authorize them with the app.
View after signing in:
When I get to the following page (in this case its where my redirect uri points me to) I can see the authorization code on the intuit developer playground, however, in my RStudio session the console shows:
> QBOtoken <- oauth2.0_token( + endpoint = endPoint, + app = App, + scope = "com.intuit.quickbooks.accounting", + type = "code", + cache = TRUE + ) Waiting for authentication in browser... Press Esc/Ctrl + C to abort
I am fairly new to oath 2.0 and I am unsure of what parameters to tune to get this to work. In the SO post their redirect URI goes to a localhost (The OP shows they get a "complete" message as well), I use the redirect URI the app shows me to use online. I have also tested using google.com in this parameter and it does open google up with the authorization code and other parameters in the URL. I would like to programmatically get this code stored in a variable Vs copying and pasting it.
I appreciate any help and/or direction!