noninteractive oauth with gargle fails only with cron job

I am using googlesheets4 to read in data from a google sheet to an RStudio instance on RStudioServer

When I knit the Rmd, this works fine, and I use

gs4_auth(email = "")

to use the existing token

Adding other options

gs4_auth(email = "", cache = "~/.cache/gargle",  use_oob = TRUE)

does not seem to help or hurt.

This workflow knits the Rmd as the body of an email in {blastula}, and works fine if I Source the R code to run blastula and send the email.

BUT - if I run this R file as a cron job, it fails at the gs4_auth step.
If I use gs4_deauth() to skip the auth step, the Rmd is knit, and the email sent with the cron job.

Any ideas why a gs4_auth would work when interactively triggered, but fail when triggered by a cron job??


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.