I have a script using gmailr that always works running in RStudio and works ~95% of the time running from the command prompt on Windows 10. But every once in a while, it fails with this error:
# Error: Can't get Google credentials.
# Are you running gmailr in a non-interactive session? Consider:
# * Call `gm_auth()` directly with all necessary specifics.
# Execution halted
It's not exactly a reprex, because it only fails sometimes, but this is what's failing right now:
library(gmailr)
gm_auth_configure(path = here::here("./credentials.json"))
gm_auth(
email = "My.Actual.Email@gmail.com",
cache = ".secret",
path = here::here("./credentials.json")
)
Edit: "./.secret" and "~/.R/gargle/gargle-oauth" are both empty, but they previously weren't. Is there something that makes the tokens (Not sure if that's the right word) in those locations expire or something?