mattroumaya / surveymonkey

Access your SurveyMonkey data directly from R!
https://mattroumaya.github.io/surveymonkey/
Other
42 stars 10 forks source link

Authentication when deploying to RStudio Connect #86

Closed paulditterline closed 2 years ago

paulditterline commented 2 years ago

Hello-

I'm using flexdashboard to show metrics, some of which come from Survey Monkey. I was hoping to use this package to make the data live from Survey Monkey.

My application works locally by referencing the oauth_token in fetch_survey_object() as shown below:

image

However, when I deploy and add this variable to the app in RStudio Connect:

image

The app fails, and I see the following error message in the logs:

image

Oddly, I don't see an smlogin() function available from the package.

I saw the readme was updated with some information about authentication, so I'm guessing this has been changed recently. Any thoughts on authentication for deployed applications using this package?

Thanks!

paulditterline commented 2 years ago

Turns out the error was coming from parse_survey(), and when I put the same argument in that function for the token, it worked when deployed!

mattroumaya commented 2 years ago

@paulditterline glad to hear it's working! I'm definitely interested in learning more about RStudio Connect, but don't currently use it at my job.

sfirke commented 2 years ago

FWIW I believe smlogin was a function left over from the version of this package developed years ago by Thomas Leeper, for the v2 API (SurveyMonkey is now on v3). That may have been a bit I left in, intending to update but not finishing it? At any rate I don't think smlogin is relevant anymore.

mattroumaya commented 2 years ago

Thanks for the background info, @sfirke!

A few people have encountered the smlogin() error recently, so I'm going to update it and instead direct to the sm_oauth_token documentation.