I am attempting to connect to the QuickBooks Online (QBO) API and when I try to connect I get this error in the browser:
The state query parameter is missing from the authorization request
And then when I go back to R, it is asking for the authorization code.
Here is my code:
###clear environment
rm(list = ls())
###install & load any necessary packages
library(httr)
library(httpuv)
library(curl)
library(jsonlite)
library(base64enc)
###set working directory
setwd([Working Directory])
##Write Client ID, Client Secret, & Scope from QBO website
ClientID <- [Client ID]
ClientSecret <- [Secret]
ClientScope <- [Scope]
end_point <- httr::oauth_endpoint(authorize = [Auth Link ending in oauth2],
access = [access link ending in tokens/bearer],
base_url = [base URL]
)
app_oauth <- httr::oauth_app([App name],
key = ClientID,
secret = ClientSecret
)
pls_token <- httr::oauth2.0_token(end_point,
app_oauth,
scope = ClientScope,
user_params = NULL,
type = NULL,
use_oob = TRUE,
oob_value = [Redirect URI],
as_header = TRUE,
use_basic_auth = FALSE,
cache = TRUE,
config_init = list(),
client_credentials = FALSE,
credentials = NULL,
query_authorize_extra = list()
)
I'm confused on two counts, 1) why would R prompt me to enter the auth code, I thought this code was supposed to get the auth code and then immediately return it to then get the access & refresh codes; 2) where would I enter a CSRF code and how does that work within the oauth dance?
Thank you!