Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to authenticate users of Shiny apps on shinyapps.io for Google Sheets (googlesheets)

I have a Shiny app making use of the googlesheets package which requires the user to authenticate for writing to Google Sheets (despite the Sheet being public and "published to the web"). This is done graphically in a browser, and works when the Shiny app is run locally. However, when deployed on shinyapps.io, the authentication call crashes the app and logs an error:

Warning: Error in : oauth_listener() needs an interactive environment.

So, what options are there? I'm thinking it would be a bad idea to upload my own .httr-oauth file or token to shinyapps.io... Any workarounds?

like image 565
adatum Avatar asked Jul 06 '16 01:07

adatum


People also ask

How do you publish a shiny app on a shiny Server?

Publish your Shiny App to RStudio ConnectAt the top of the editor, click Publish. In the Publish to Server window, confirm that your account is shown in the Publish To Account section and click Publish. You can monitor the status of the deployment in the RStudio IDE Deploy pane.


1 Answers

In case anyone else has a problem with this, the new {googlesheets4} provides a solution:

https://googlesheets4.tidyverse.org/articles/articles/auth.html

If you don’t need to access private Sheets, use gs4_deauth() to indicate there is no need for a token. This puts googlesheets4 into a de-authorized mode.

(an example script is also included)

like image 122
SOwla Avatar answered Sep 30 '22 10:09

SOwla