Login to your own Google account through a deployed shiny app

Hi All,

I have an app which reads and writes to a user's own Google Drive account using googlesheets4 and googledrive.This works fine when run locally but throws an error when deployed on shinyapps.io.

Error in value[3L] : Can't get Google credentials.
Are you running googledrive in a non-interactive session? Consider:

  • drive_deauth() to prevent the attempt to get credentials.
  • Call drive_auth() directly with all necessary specifics.
  • Read more in: Non-interactive auth • gargle

I have added the following to the top of the script:

options(gargle_oob_default = TRUE)

as recommended here:

...but no joy. I've also added the following to the top of the script to streamline authentication (not that I am getting that far)

gs4_auth(token = drive_token())

as recommended here:

Essentially what I want to do is replicate the functionality in the Google Explorer example app here:

Unfortunately, authentication with googlesheets no longer works so we have to use googlesheets4 and authentication works differently now so this example doesn't really help. Note, that the app is interactive and the user will need to select their own account. Most posts I have found focus on non-interactive authentication to a single account.

Can anyone help? Thanks.